Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the curl timeout in facebook php web-driver

I'm using facebook/php-webdriver when I'm trying to connect to any website with a proxy using the following code :

$driver = RemoteWebDriver::create($host, $capabilities);

try{
    $driver->navigate()->to("http://www.example.com/");
} catch (Exception $e) {
    echo $e->getMessage();
}

It will take time because the proxy is sometimes slow then return the following error :

Curl error thrown for http POST to /session/c189e325-9057-489c-b2de-93c95cdb1cc4/url with params: {"url":"http://www.live.com/"}

Operation timed out after 30001 milliseconds with 0 out of -1 bytes received

Question: It's possible to increase the curl timedout delay 30001 milliseconds ?

like image 943
Zakaria Acharki Avatar asked May 27 '16 12:05

Zakaria Acharki


1 Answers

RemoteWebDriver::create() supports specifying the connection and request timeout as the third and fourth arguments, e.g.

$driver = RemoteWebDriver::create(
  $host,
  $capabilities,
  60 * 1000, // Connection timeout in miliseconds
  60 * 1000  // Request timeout in miliseconds
);

See: https://github.com/php-webdriver/php-webdriver/blob/1.9.0/lib/Remote/RemoteWebDriver.php#L88

like image 162
iainn Avatar answered Oct 11 '22 07:10

iainn