SOAP and file_get_contents() fails to retrieve wsdl from nonstandard port

I'm trying to get some prices from a web service at:

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

with code:

$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()); 

and it fails with:

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

I tried to get the xml at that address with

$xmlfile = file_get_contents ( 'http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl' );

Again, failed with no error but an empty string.

Upvotes: 2

Views: 3004

Answers (1)

Ren&#233; H&#246;hle
Ren&#233; H&#246;hle

Reputation: 27295

Your code is working well i think you have enabled some security features like the allow_url_fopen. Set that value in your php.ini to on.

Its no SSL otherwise you have to check the openssl extension, too.

Upvotes: 1

Related Questions