php - SOAP-ERROR: Parsing WSDL: Couldn't load from - but works on WAMP -


This works fine on my WAMP server, but does Linux not work on master server ?!

  Try {$ client = New SOAP client ('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', ['trace' => true]) ; $ Result = $ client- & gt; Checkavate (['countrycode' => gt; 'dk', 'vatNumber' => '47458714']); Print_r ($ result); } Hold (exception $ e) {echo $ e-> GetMessage (); }  

What am I missing here?! SOAP is enabled

EU / taxation_customs / vies / checkVatService.wsdl ': External institution "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"/taxation_customs/vies/checkVatService.wsdl" load To do
  $ wsdl = file_get_contents ('http://ec.europa.eu) / ex> 

call url from php

/taxation_customs/vies/checkVatService.wsdl '); $ wsdl echo;

error

  Warning: file_get_contents (http: //ec.europa.eu/taxation_customs/vies/checkVatService.wsdl): Request failed HTTP / 1.0 503 service unavailable  

URL call from command line

Calling HTTP : Stream Failed to open URL returned from the Linux command line with html 200 xml reservation

  curl http://ec.europa.eu/taxation_customs /vies/checkVatService.wsdl  

For some versions of PHP, SoapClient HTTP User Agent Does not send information about What are the PHP versions on your local WAMP vs server?

Try setting a user agent explicitly, use a reference stream like this:

  try {$ opts = array ('http' = & Gt; array ('user_agent' = & gt; 'PHPSoapClient')); $ Context = stream_context_create ($ opts); $ WsdlUrl = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; $ SoapClientOptions = array ('stream_context' = & gt; $ context, 'cache_wsdl' = & gt; WSDL_CACHE_NONE); $ Client = new sop client ($ wsdlUrl, $ soapClientOptions); $ CheckVatParameters = array ('countrycode' = & gt; 'dk', 'vatNumber' => '47458714'); $ Result = $ client- & gt; Checkout ($ checkout parameter); Print_r ($ result); } Hold (exception $ e) {echo $ e-> GetMessage (); }  

edit

This is actually some problems with the web service you are using. Combining HTTP on IPv6, and rendering absent HTTP user agent string, web service issues.

To verify this, try the following on your Linux host:

  curl-a '' -6 http://ec.europa.eu/taxation_customs/ Vies / checkVatService.wsdl  

This IPv6 request fails.

  curl - a 'cURL user agent' -6 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl  

This IPv 6 The request is successful.

  curl - a '' -4 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl curl - a 'cURL user agent' -4 http: // ec. Europa.eu/taxation_customs/ vies / checkVatService.wsdl  

Both of these IPv4 requests are successful.

Interesting case :) I think your Linux host resolves ec.europa.eu to your IPv6 address, and that your version of SoapClient does not add a user agent string by default.


Comments