php soapclient wsdl SOAP-ERROR: WSDL analysis: Unable to load from


I have googled and looked here in stackoverflow but I have not found a solution to my specific problem. I keep getting the error

 SOAP-ERROR: Parsing WSDL: Couldnt load from "" : failed to load external entity ""

I am trying to use a SOAP API with a URL like

I am running MAMP on my localhost and using godaddy shared hosting, I have tried on both with the wsdl file can be found here

In PHP I use the code below

ini_set('display_errors', 'On');
ini_set('soap.wsdl_cache_enabled', 0);

echo "<pre>";

try {

$url     = " ";
$headers = [
    'Connection: Keep-Alive',
    'User-Agent: PHP-SOAP/5.3.29',
    'Content-Type: text/xml; charset=utf-8',
    'SOAPAction: "RequestTransaction"',
    'Content-Length: 409'];

$rq = [
"userName" => "username_here",
"passWord" => "password_here",
"referenceId" => "3455566694",
"msisdn" => "346774313"];

try {

$cient = new SoapClient($url,
    'soap_version' => SOAP_1_2,
    'exceptions' => 1,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'trace' => 1,
    'stream_context' => stream_context_create(array('http' => array('header' => $headers)))

} catch (SoapFault $e) {
    echo "\nFault Code: ".$e->faultcode;
    echo "\nFault String: ".$e->faultstring;

On my MAMP localhost i have SOAP,openssl and curl.

ALSO, I tried using (sending request) to the API with an online WSDL it WORKS but on code using PHP it fails

It often happens that providers neglect their SSL certificates and hence the sites and services end up having an invalid certificates - I suspect this is the case here.

Disabling the certificate validation as described by Kaii here or even better get your provider to fix their certificate.

Your code could/should then be something like:

$url     = " ";
$context = stream_context_create(array(
        'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true

$rq = ["userName" => "username_here",
       "passWord" => "password_here",
       "referenceId" => "3455566694",
       "msisdn" => "346774313"];

$service = new SoapClient($url, array('stream_context' => $context));