I want to use proxy when request for a page in guzzle. The code below encountered with a warning:
Warning: curl_setopt_array(): Array keys must be CURLOPT constants or equivalent integer values in .../guzzle/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 56
Warning: curl_setopt_array(): Array keys must be CURLOPT constants or equivalent integer values in .../guzzle/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 56
Warning: curl_setopt_array(): Array keys must be CURLOPT constants or equivalent integer values in .../guzzle/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 56
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Run-time warning: curl_setopt_array(): Array keys must be CURLOPT constants or equivalent integer values in .../guzzle/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 56
What is the problem with this code:
this->method = 'GET';
$this->request = new Request($this->method, $this->url);
$this->options = [
'base_uri' => $this->base_uri,
'timeout' => 30,
'curl' => [
'CURLOPT_PROXY' => '*.*.*.*',
'CURLOPT_PROXYPORT' => 80,
'CURLOPT_PROXYUSERPWD' => '*:*',
],
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36'
]
];
$this->response = $this->send($this->request, $this->options);// $this extends Client Class