I'm having some problems calling a SOAP service with PHP. The URL is correct, to test if so i call the client's methods "__getFunctions()" and "__getTypes()" and i see what i aspect. But when I call the function that I need ("GetClubList_TANTOSVAGO" passing a token string) the response is "Could not connect to host".
I use a SOAP client in another website on the same server and i haven't thi kind of problem. PHP Version is 7.2.9.
try {
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 0);
$url = "https://testint.virginactive.it/Gamma_api.asmx?wsdl";
$context = stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
));
$opt = array(
'stream_context' => $context,
"authentication" => SOAP_AUTHENTICATION_BASIC,
"trace" => true,
"exceptions" => 1,
"cache_wsdl" => WSDL_CACHE_NONE,
"connection_timeout" => 30
);
$client = new SoapClient($url, $opt);
fwrite($fileLog, date('Y-m-d H:i:s') . ' - SOAP Functions ' . json_encode($client->__getFunctions()) . PHP_EOL);
fwrite($fileLog, date('Y-m-d H:i:s') . ' - SOAP Types ' . json_encode($client->__getTypes()) . PHP_EOL);
$response = $client->GetClubList_TANTOSVAGO("123456789");
} catch (SoapFault $e) {
fwrite($fileLog, date('Y-m-d H:i:s') . ' - Error' . $e->getMessage() . PHP_EOL);
}