やたら重たい処理をさせたいけど、先にGoutteがへばってしまうと困るのでタイムアウト秒数を変えたい時、以下のように書いたら行けるみたいですね(´・ω・`)
1 2 3 |
use Goutte\Client; $client = new Client(); $client->getClient()->setDefaultOption("config/curl/" . CURLOPT_TIMEOUT_MS, 100000); |
もしくは以下の書き方。
1 2 3 4 5 6 7 8 9 10 11 12 |
use Goutte\Client; $client = new Client(); $guzzleClient = new GuzzleClient( array( "defaults" => array( "config" => array( "curl" => array(CURLOPT_TIMEOUT_MS => 100000, CURLOPT_RETURNTRANSFER => true) ) ) ) ); $client->setClient($guzzleClient); |
参考 cURL timing out even after setting timeout value · Issue #197 · FriendsOfPHP/Goutte · GitHub