Bind SoapClient request to a specific IP

CyberSight32

New Member
I need to implement a webservice where the \[code\]SoapServer\[/code\] requires me to send data using a specific IP at the \[code\]SoapClient\[/code\] machine which have a bunch of different IPs. Problem is, how to force PHP to send that request using this specific IP?PHP documentation on SOAP is really poor.Thanks.With halfdan's answer i was able to fix the issue, so i'm posting a snippet of how it turned out:\[code\]protected function load_ws() { if ($this->ws == null) { // load webservice ini_set("soap.wsdl_cache_enabled", 0); ini_set("allow_url_fopen", 1); try { if ($this->context == null) // load stream context socket $this->context = stream_context_create(array( "socket" => array( "bindto" => te_auth_ip.":0" ) )); $this->ws = new SoapClient($this->wsdl_path, array( "soap_version" => SOAP_1_1, "style" => SOAP_RPC, "use" => SOAP_ENCODED, "authentication" => SOAP_AUTHENTICATION_BASIC, "login" => te_login, "password" => te_pass, "encoding" => "UTF-8", "trace" => true, "exceptions" => true, "compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, "connection_timeout" => te_timeout, "stream_context" => $this->context )); } catch (SoapFault $fault) { $this->error($fault, "LOAD"); } }}\[/code\]
 
Back
Top