Is it possible to specify the outgoing network interface to use for a PHP SoapClient?

心不动则不痛 提交于 2019-12-01 18:49:34

问题


I need to bind a SoapClient to a specific outbound network interface, but I cannot find any documentation on this. Is this even possible? If not, what are some possible workarounds?


回答1:


You can pass a stream context to your soapclient constructor that has a bindto options set:

$opts = array(
    'socket' => array(
        'bindto' => '192.168.0.100:0',
     ),
);

$ctx = stream_context_create($opts);

$client = new SoapClient('the.wsdl', array('stream_context' => $ctx));


来源:https://stackoverflow.com/questions/3444359/is-it-possible-to-specify-the-outgoing-network-interface-to-use-for-a-php-soapcl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!