How to set timeout for google api php client library
I am using google php client library to build an application. Sometimes Google will respond to an API request in 100 seconds. I would like to limit the socket timeout to 30 seconds.
Does anyone know how this is possible? Not seeing any clear examples in the docs and I didn't get anything out of control looking at the source.
I found this example in the docs for a Java client, but I can't seem to find the PHP equivalent.
Thanks for any help.
+3
source to share
2 answers
According to this question, you can pass parameters directly for curling.
$client->setClassConfig('Google_IO_Curl', 'options',
array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 10
)
);
+1
source to share