PHP SoapClient 无法使用 https WS

问题描述:

我在使用包含 https 的 WS (WSDL) 的 PHP SoapClient 时遇到问题.我的 PHP 版本是 5.2.5.在你问之前,是的,我正在使用 PHP 的 Soap 和 openSSL 扩展.

i have a problem working with PHP SoapClient with a WS (WSDL) that contains https. my PHP version is 5.2.5. before you ask, yes, i am using PHP's Soap and openSSL extentions.

我试图访问的 URL 是:https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL

the URL i am trying to reach is: https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL

我使用的代码:

$url = "https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL";
$options["connection_timeout"] = 25;  
$options["location"] = $url;

$client = new SoapClient($url,$options);

它在构建 SoapClient 时失败,我收到以下错误:

it fails while constructing the SoapClient, and i get the following error:

警告:SoapClient::SoapClient(https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL):无法打开流:连接尝试失败,因为连接方在一段时间后没有正确响应,或建立连接失败,因为已连接主机未能响应.在 C:\MY-DEV-FOLDER\index.php 第 42 行警告:SoapClient::SoapClient():I/O 警告:无法加载外部实体https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL" in C:\MY-DEV-FOLDER\index.php 第 42 行抛出异常 - SOAP-ERROR:解析 WSDL:无法从 'https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL'

Warning: SoapClient::SoapClient(https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL): failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\MY-DEV-FOLDER\index.php on line 42 Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL" in C:\MY-DEV-FOLDER\index.php on line 42 Exception thrown - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL'

谁能告诉我这是什么问题?

can anyone tell me what is the problem?

谢谢

埃雷兹

您需要在 PHP 中启用 OpenSSL 才能通过 https 检索内容.

You will need to have OpenSSL enabled in PHP to be able to retrieve content over https.

在 php.ini 中取消注释这一行

Uncomment this line in php.ini

extension=php_openssl.dll

在 phpinfo() 中查找 openssl 部分:

Look for the openssl section in your phpinfo():

OpenSSL support => enabled  
OpenSSL Library Version => OpenSSL 0.9.8k 25 Mar 2009
OpenSSL Header Version => OpenSSL 0.9.8k 25 Mar 2009