Due to a bug in the WURFL Cloud Client code, the default method of adjusting the timeout is not honored, but version 2 of the client is finished, and we're just days away from release. Note, however, that the new client for PHP will require some minor changes since the new library is namespaced.
In the meantime, you can extend the included fsock HTTP class to adjust the timeout:
Code: Select all
class CustomHttpClient extends WurflCloud_HttpClient_Fsock {
// Set time in milliseconds (10000 = 10 seconds)
protected $timeout_ms = 10000;
}
Then you can tell the client to use this client:
Code: Select all
$config = new WurflCloud_Client_Config();
$config->http_method = 'CustomHttpClient';
$config->api_key = '123456:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client = new WurflCloud_Client_Client($config);
Note that increasing the timeout will not guarantee that no exceptions will be thrown. For example, on my local test machine (Ubuntu Linux), there is a local DNS proxy that occasionally fails, which causes a DNS error, which results in an exception in the client. If you really want to catch all the exceptions, you'll need to wrap your code in a try/catch block:
Code: Select all
try {
$client->detectDevice();
} catch (Exception $e) {
// Client threw exception, do something more graceful here
}