SOAP和file_get_contents()无法从非标准端口检索wsdl

时间:2015-01-02 12:58:27

标签: php soap

我正试图通过以下网站服务获得一些价格:

http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl

代码:

$wsdl = 'http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl';
$opts = array('http' => array('protocol_version' => '1.0'));
$context = stream_context_create($opts);
$client = new SoapClient($wsdl, array('stream_context' => $context));


var_dump($client->__getFunctions()); 
var_dump($client->__getTypes()); 

它失败了:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl' : Start tag expected, '<' not found in /home/cererepi/public_html/elit/connect.php:6 Stack trace: #0 /home/cererepi/public_html/elit/connect.php(6): SoapClient->SoapClient('http://icelit02...', Array) #1 {main} thrown in /home/cererepi/public_html/elit/connect.php on line 6

我试图用

获取该地址的xml
$xmlfile = file_get_contents ( 'http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl' );

同样,失败但没有错误,只是一个空字符串。

1 个答案:

答案 0 :(得分:1)

您的代码运行良好我认为您启用了一些安全功能,例如allow_url_fopen。将 php.ini 中的值设置为on

它没有SSL,否则你也必须检查openssl扩展。