soapclient or fopen not working

2019-08-27 01:19发布

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条回答
▲ chillily
2楼-- · 2019-08-27 01:51

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

查看更多
登录 后发表回答