views:

35

answers:

1

Hi,

im trying to connect to a wsdl service , but getting this error:

wsdl error: Getting http://api.didww.com/api/?wsdl - HTTP ERROR: socket read of headers timed out

locally there is no problem, but on the remote server i get this error.

remote server: Linux CentOS (FreePBX)

the code:

$client = new soapclient($site, true);
$err = $client->getError();
if ($err)
{
    echo 'ERROR: ' . $err . '</pre>';
}

$username = 'XXXX';
$_key = 'YYYY';
$auth_string = sha1($username.$_key);

$arr = array();
$arr[0] = $auth_string;
$arr[1] = $country_id;

$result = $client->call('getcities', $arr);

if ($client->fault)
{
    echo '<pre>';
    print_r($result);
    echo '</pre>';
}
else
{
    $err = $client->getError();
    if ($err)
    {
        echo 'Error: <pre>' . $err . '</pre>';
    }
}
echo '<pre>';
print_r($result);
echo '</pre>';

Thanks in advanced

A: 

Default socket timeout is set in ini so you can just increase it and see if it works then ini_set('default_socket_timeout', 160);

Or you can pass it as a constructor parameter (option) to soapclient $client = new SoapClient($wsdl, array("connection_timeout"=>15));

Shaun Hare
its working , but the problem is that it takes ages to load, 1:30 avg, and on the local server, and other servers, few mili seconds. what could be the problem?
WEBProject