PHP SoapClient 无法使用 https WS

发布于 2024-09-19 09:36:26 字数 1478 浏览 5 评论 0原文

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

我试图到达的网址是: 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 时失败,并且出现以下错误:

警告: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" 在 C:\ MY-DEV-FOLDER\index.php 第 42 行抛出异常 - SOAP 错误:解析 WSDL:无法从 'https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL'

谁能告诉我问题是什么?

谢谢埃雷兹

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.

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

the code i am using:

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

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

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

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?

thanks

Erez

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

疾风者 2024-09-26 09:36:26

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

在 php.ini 中取消注释此行在

extension=php_openssl.dll

phpinfo() 中查找 openssl 部分:

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

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

Uncomment this line in php.ini

extension=php_openssl.dll

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
那片花海 2024-09-26 09:36:26

我刚刚运行了您提供的代码,它工作得很好:

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

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

print_r($client->__getFunctions());

结果

Array
(
    [0] => ID3CheckInitialise_1bResponse ID3CheckInitialise_1b(ID3CheckInitialise_1b $parameters)
    [1] => ID3AddressLookupInitialise_1bResponse ID3AddressLookupInitialise_1b(ID3AddressLookupInitialise_1b $parameters)
    [2] => ID3Check_1bResponse ID3Check_1b(ID3Check_1b $parameters)
    [3] => AddressLookup_1bResponse AddressLookup_1b(AddressLookup_1b $parameters)
)

所以也许您应该检查是否存在任何网络问题:是否有防火墙阻止您的服务器进程内的通信? (我假设它是 IIS?)您可能还想检查 safe_mode 设置,尽管我怀疑这是这里的问题。

I just ran the code you gave and it worked perfectly:

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

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

print_r($client->__getFunctions());

results in

Array
(
    [0] => ID3CheckInitialise_1bResponse ID3CheckInitialise_1b(ID3CheckInitialise_1b $parameters)
    [1] => ID3AddressLookupInitialise_1bResponse ID3AddressLookupInitialise_1b(ID3AddressLookupInitialise_1b $parameters)
    [2] => ID3Check_1bResponse ID3Check_1b(ID3Check_1b $parameters)
    [3] => AddressLookup_1bResponse AddressLookup_1b(AddressLookup_1b $parameters)
)

So maybe you should check if there are any network problems: Is there a firewall blocking the communication from within your server process? (I assume it's IIS?) You may also want to check safe_mode settings, although I doubt this is the problem here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文