Changing the SOAP end point URL in PHP

The endpoint URL is where the web service can be accessed by a client application. The same web service can have multiple endpoints.

The SoapClient of your PHP, uses the endpoint URL from the WSDL file by default.
It looks like this:

Our application faced an issue where the endpoint got changed and we were getting: “Could not connect to host error.”

To fix that, we changed the endpoint from our php application by adding this:

$client = new soapclient($soapWSDLURL);
$client->__setLocation(‘newEndpointUrl’);

which is the same as :

$client = new soapclient($soapWSDLURL, array(‘location’ => ‘newEndpointUrl’));

Hope that was helpful!
Thanks,
Pallavi