soapclient or fopen not working

感情迁移 提交于 2019-12-25 04:42:52

问题


I'm trying to set up a PHP SoapClient to connect to a wsdl... CURL & WGET from the server work fine.

If I try to use soapclient I receive the error messages below.

    $wsdl = 'http://pav3.cdyne.com/PavService.svc?wsdl';

try {
    $client = new SoapClient($wsdl, array('trace' => true, 'exceptions' => true));
} catch (SoapFault $f) {
    echo $client->_getLastRequest();
    echo $client->_getLastResponse();
    echo $f->getMessage();
} catch (Exception $e) {
    echo $client->_getLastRequest();
    echo $client->_getLastResponse();
    echo $e->getMessage();
}

I get the error message:

<br /><b>Warning</b>:  SoapClient::SoapClient(http://pav3.cdyne.com/PavService.svc?wsdl) [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: failed to open stream: HTTP request failed!  in <b>/coachflex/www/htdocs/CoachFlex/modules/other/checkAddress.php</b> on line <b>35</b><br />

<br /><b>Warning</b>:  SoapClient::SoapClient() [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: I/O warning : failed to load external entity &quot;http://pav3.cdyne.com/PavService.svc?wsdl&quot; in <b>/coachflex/www/htdocs/CoachFlex/modules/other/checkAddress.php</b> on line <b>35</b><br />

If i try to simply use fopen on the above address, I get:

Warning: fopen(http://pav3.cdyne.com/PavService.svc?wsdl) [function.fopen]: failed to open stream: HTTP request failed! in /coachflex/www/htdocs/CoachFlex/modules/other/checkAddress.php on line 37

I just cannot figure out why I can connect via curl/wget, but not through PHP. allow_url_fopen is set to On


回答1:


I solved my problem. It was actually an issue with my firewall. The firewall was dropping packets sent via PHP, but via curl or wget were not being dropped. I added a rule for all traffic from that server and increased the packet drop length and everything is working great now!

This page was what pointed me in the right direction: http://www.radiotope.com/content/safari-and-sonicwall



来源:https://stackoverflow.com/questions/3494910/soapclient-or-fopen-not-working

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