Beispiel #1
0
 public function execute(Request $request)
 {
     $guzzle = new GuzzleClient();
     if ($request->getVerb() == 'GET') {
         $guzzleRequest = $guzzle->get($request->getUrlWithQueryString());
     }
     if ($request->getHeader()) {
         list($headerName, $headerValue) = $request->getHeader();
         $guzzleRequest->setHeader($headerName, $headerValue);
     }
     $this->response = $guzzleRequest->send();
     return $this->getBody();
 }
Beispiel #2
0
 public function execute(Request $request)
 {
     $this->curl = curl_init();
     curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($this->curl, CURLOPT_URL, $request->getUrlWithQueryString());
     curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $request->getVerb());
     if ($request->getHeader()) {
         list($headerName, $headerValue) = $request->getHeader();
         curl_setopt($this->curl, CURLOPT_HTTPHEADER, array($headerName . ": " . $headerValue));
     }
     $this->response = curl_exec($this->curl);
     $this->validateResponse();
     curl_close($this->curl);
     return $this->getBody();
 }