I\'m trying to invoke a WS over https on a remote host:remote port and I get:
Error fetching http headers
using the PHP5 SoapCli
Another possible cause of this error could be some OpenSSL operations leaving not cleared errors. Put this piece of code before the SOAP request to clear them:
while (openssl_error_string()) {}
Setting 'keep_alive'
to false worked for me:
new SoapClient($api_url, array('keep_alive' => false));
The configuration that has worked for me was defining at my php script the following parameters:
ini_set('default_socket_timeout', 5000);
$client = new \SoapClient($url,array(
'trace' =>true,
'connection_timeout' => 5000,
'cache_wsdl' => WSDL_CACHE_NONE,
'keep_alive' => false,
));
Please, comment.
The most important parameter definition, as per my experience with this issue was
ini_set('default_socket_timeout', 5000);
During my tests I have defined the default_socket_timeout to 5 seconds and the error 'Error Fetching http headers' was raised instantaneously.
I hope it helps you!