Doctrine\OrientDB\Binding\Client\Http\CurlClient::execute PHP Method

execute() public method

Executes a Curl.
public execute ( String $method, String $location ) : CurlClientResponse
$method String
$location String
return CurlClientResponse
    public function execute($method, $location)
    {
        curl_setopt_array($this->curl, array(CURLOPT_URL => $location, CURLOPT_COOKIE => $this->getRequestCookies(), CURLOPT_CUSTOMREQUEST => $method));
        if (!($response = curl_exec($this->curl))) {
            $this->restart();
            throw new EmptyResponseException($this, $location);
        }
        $response = new CurlClientResponse($response);
        $this->cookies = array_merge($this->cookies, $response->getCookies());
        if ($this->restart == true) {
            $this->restart();
        }
        return $response;
    }

Usage Example

 /**
  * @expectedException \Doctrine\OrientDB\Binding\Exception\ConnectionFailedException
  */
 public function testRetrievingAnEmptyResponseRaisesAnException()
 {
     $client = new CurlClient();
     $client->execute('GET', '');
 }