我正在尝试从以下网络服务中获取一些价格:
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' );
同样,失败,没有错误,但有一个空字符串。
您的代码运行良好,我认为您已经启用了一些安全功能,例如allow_url_fopen
.在 php.ini 中将该值设置为 on
。
它没有SSL,否则您还必须检查openssl扩展。