protected function call($command, array $options = array())
	{
		$curl = curl_init();
		$options[CURLOPT_URL] = $this->command_url($command);
		$options[CURLOPT_RETURNTRANSFER] = TRUE;
		$options[CURLOPT_FOLLOWLOCATION] = TRUE;

		curl_setopt_array($curl, $options);

		$raw = '';

		Attempt::make(function() use ($curl, & $raw) {
			$raw = trim(curl_exec($curl));
			return curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200;
		});

		$error = curl_error($curl);
		$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

		curl_close($curl);

		if ($error)
			throw new Exception_Driver('Curl ":command" throws exception :error', array(':command' => $command, ':error' => $error));

		if ($code != 200)
			throw new Exception_Driver('Unexpected response from the panthomjs for :command: :code', array(':command' => $command, ':code' => $code));

		$result = json_decode($raw, TRUE);

		return $result;
	}
protected function call($command, array $options = array())
	{
		$curl = curl_init();
		$options[CURLOPT_URL] = $this->command_url($command);
		$options[CURLOPT_RETURNTRANSFER] = TRUE;
		$options[CURLOPT_FOLLOWLOCATION] = TRUE;

		curl_setopt_array($curl, $options);

		$raw = '';

		Attempt::make(function() use ($curl, & $raw) {
			$raw = trim(curl_exec($curl));
			return curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200;
		});

		$error = curl_error($curl);
		$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

		curl_close($curl);

		if ($error)
			throw new Exception_Driver('Curl ":command" throws exception :error', array(':command' => $command, ':error' => $error));

		if ($code != 200)
			throw new Exception_Driver('Unexpected response from the panthomjs for :command: :code', array(':command' => $command, ':code' => $code));

		$result = json_decode($raw, TRUE);

		return $result;
	}
protected function call ( $ command , array $ options = array ( ) ) { $ curl = curl_init ( ) ; $ options [ CURLOPT_URL ] = $ this -> command_url ( $ command ) ; $ options [ CURLOPT_RETURNTRANSFER ] = TRUE ; $ options [ CURLOPT_FOLLOWLOCATION ] = TRUE ; curl_setopt_array ( $ curl , $ options ) ; $ raw = '' ; Attempt :: make ( function ( ) use ( $ curl , & $ raw ) { $ raw = trim ( curl_exec ( $ curl ) ) ; return curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) == 200 ; } ) ; $ error = curl_error ( $ curl ) ; $ code = curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; curl_close ( $ curl ) ; if ( $ error ) throw new Exception_Driver ( 'Curl ":command" throws exception :error' , array ( ':command' => $ command , ':error' => $ error ) ) ; if ( $ code != 200 ) throw new Exception_Driver ( 'Unexpected response from the panthomjs for :command: :code' , array ( ':command' => $ command , ':code' => $ code ) ) ; $ result = json_decode ( $ raw , TRUE ) ; return $ result ; }
Perform a custom request on the phantomjs server, using curl
@param  string $command
@param  array  $options
@return mixed
Perform a custom request on the phantomjs server using curl