SOAP错误:解析WSDL:无法从中加载-但可在WAMP上使用

这在我的WAMP服务器上工作正常,但在linux主服务器上不起作用!


try{

    $client = new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', ['trace' => true]);

    $result = $client->checkVat([

        'countryCode' => 'DK',

        'vatNumber' => '47458714'

    ]);

    print_r($result);

}

catch(Exception $e){

    echo $e->getMessage();

}

我在这里想念什么?:(


启用了SOAP


错误

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl' : failed to load external entity "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"/taxation_customs/vies/checkVatService.wsdl"

从PHP调用URL

从PHP调用URL返回错误


$wsdl = file_get_contents('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');

echo $wsdl;

错误

Warning:  file_get_contents(http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable

从命令行调用URL

从Linux命令行调用URL HTTP 200并返回XML响应


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


HUWWW
浏览 794回答 3
3回答

喵喔喔

尝试这个。希望对您有所帮助$options = [    'cache_wsdl'     => 0,    'trace'          => 1,    'stream_context' => stream_context_create(        [            'ssl' => [                'verify_peer'       => false,                'verify_peer_name'  => false,                'allow_self_signed' => true            ]        ]    )];$client = new SoapClient($url, $options);
打开App,查看更多内容
随时随地看视频慕课网APP