Changing the default timeout for HTTP requests in PHP


If you are using the PHP client library to upload videos to YouTube, you may run into problems where your requests are timing out after ten seconds. The client library makes use of the Zend_Http_Client component to dispatch requests to the API server. By default the client object is initialized to time out any requests after 10 seconds. The snippet below shows how you may increase the timeout to 30 seconds:
// assuming your Zend_Http_Client already exists as $httpClient
// and that you want to change the timeout from the 10 second default to 30 seconds
$config = array('timeout' => 30);
$httpClient->setConfig($config);