Closed nvcken closed 8 years ago
This is likely because you're behind some kind of shared hosting that's blocking the calls? It shouldn't take 10 seconds to make a request.
Regardless, that's a cURL error converted to an exception. If you look at performRequest() you'll see the second parameter allows you to pass custom cURL parameters through.
With that in mind, you could try increasing the timeout:
performRequest(true, ['CURLOPT_TIMEOUT' => 20]);
CURLOPT_TIMEOUT The maximum number of seconds to allow cURL functions to execute
There's also:
CURLOPT_TIMEOUT_MS The maximum number of milliseconds to allow cURL functions to execute
All the available options are in the php manual.
You can keep upping the time limit to be able to make a request, but something is being blocked and taking a long time that shouldn't be there for you to make a single simple request to twitter. Try pinging twitter from the box to see if you can even talk to them. This doesn't look like an issue on the wrapper's side.
I tried it, thanks for help.
performRequest(true, [CURLOPT_TIMEOUT => 20]);
This
performRequest(true, [CURLOPT_TIMEOUT => 20]);
cannot work because options array passed to the method is appended to the library's base options:
$options = array(
CURLOPT_HTTPHEADER => $header,
CURLOPT_HEADER => false,
CURLOPT_URL => $this->url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
) + $curlOptions;
Quoting PHP docs
If you want to append array elements from the second array to the first array while not overwriting the elements from the first array and not re-indexing, use the + array union operator. The keys from the first array will be preserved. If an array key exists in both arrays, then the element from the first array will be used and the matching key's element from the second array will be ignored.
got error