这是代码:
$this->baseUrl = "https://sfbay.craigslist.org/sfc/apa/";
$this->client = new Goutte\Client();
$curlOptions = array(
CURLOPT_CONNECTTIMEOUT => 600,
CURLOPT_TIMEOUT => 600
);
$this->client->getClient()->setDefaultOption('config', ['curl' => $curlOptions]);
$crawler = $this->client->request("GET", $this->baseUrl);
错误(重复两次):
PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message '[curl] (#28) See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of cURL errors [url] https://sfbay.craigslist.org/sfc/apa/' in /Users/...../vendor/guzzlehttp/guzzle/src/Adapter/Curl/MultiAdapter.php:216
问题是:代码在一小时前工作,没问题!在发现错误 #28 超时后,我添加了 cURL 选项。
我错过了 cURL 选项吗?或者也许我设置的值错误?为什么要改变?我不在一个明显较慢的网络(AFAIK)上。