Wurfl Cloud Server unable to connect

Questions about the WURFL Cloud service.
jetsynthesys
Posts: 3
Joined: Wed Aug 05, 2015 2:46 am

Wurfl Cloud Server unable to connect

Postby jetsynthesys » Wed Aug 05, 2015 2:54 am

We're getting curl error "unable to contact server'
Fatal error: Uncaugh exception 'ScientiaMobile\WurflCloud\HttpClient\HttpException' with message 'Unable to contact server: cURL
Error: Resolving timed out after 1251 milliseconds'

Elliotfehr

Re: Wurfl Cloud Server unable to connect

Postby Elliotfehr » Wed Aug 05, 2015 8:55 am

Hello,

Are you seeing this error on a regular basis? Is this timeout occurring on production servers or only in a local development environment while testing? Are you also able to provide me with the geographic region that these requests are originating from?

Thank you,

Elliot

jetsynthesys
Posts: 3
Joined: Wed Aug 05, 2015 2:46 am

Re: Wurfl Cloud Server unable to connect

Postby jetsynthesys » Thu Aug 06, 2015 4:56 am

Hi Elliot,

This error is occurring occasionally on production server and the geographic region from where the requests are origination is India.

Elliotfehr

Re: Wurfl Cloud Server unable to connect

Postby Elliotfehr » Thu Aug 06, 2015 11:23 am

It is not totally unusual to see a few failed HTTP requests per day considering the nature of the public internet. The WURFL cloud will typically answer requests in 2 milliseconds or less and the cloud client is set by default to forcefully close any requests that take over a second. I have posted a code snippet on how to raise this timeout below:

Code: Select all

<?php

require_once __DIR__.'/../src/autoload.php';

use ScientiaMobile\WurflCloud\Config;
use ScientiaMobile\WurflCloud\Client;
use ScientiaMobile\WurflCloud\Cache\Cookie;
use ScientiaMobile\WurflCloud\HttpClient\Curl;

try {
    // Create a WURFL Cloud Config
    $config = new Config();

    // Set your API Key here
    $config->api_key = '123456:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

    // Create an HTTP Client
    $http_client = new Curl();

    // Increase the timeout if there are issues connecting
    $http_client->setTimeout(3000);

    // Create a WURFL Cloud Client
    $client = new Client($config, new Cookie(), $http_client);

    // Detect the visitor's device
    $client->detectDevice();

    // Show all the capabilities returned by the WURFL Cloud Service
    foreach ($client->capabilities as $name => $value) {
        echo "<strong>$name</strong>: ".(is_bool($value)? var_export($value, true): $value) ."<br/>";
    }
} catch (Exception $e) {
    // Show any errors
    echo "Error: ".$e->getMessage();
}


Who is online

Users browsing this forum: No registered users and 3 guests