Can I specify an outbound network interface for use in PHP SoapClient?

I need to bind SoapClient to a specific outgoing network interface, but I can not find any documentation on this. Is it possible? If not, what are the possible workarounds?

+4
source share
1 answer

You can pass the thread context to your soapclient constructor, which has a set of binding parameters:

$opts = array( 'socket' => array( 'bindto' => '192.168.0.100:0', ), ); $ctx = stream_context_create($opts); $client = new SoapClient('the.wsdl', array('stream_context' => $ctx)); 
+5
source

All Articles