php4 中的 Web 服务调用
我在 php5 中为自己的服务器编写了这段代码,但是当我尝试部署它时,我发现测试和生产服务器是 php4(我的错!)。所以我现在需要谁来转换它以在 php4 中运行它。
以下代码在 php5 上运行正常:
<?php
$wsdl = 'http://blahblah:8081/services/LoginWebService?wsdl';
$client = new SoapClient($wsdl);
$params->username = 'an_user';
$params->password = 'a_pass';
$res = $client->login($params);
// ak auth key
$ak = $res->loginReturn;
echo $ak;
?>
有没有一种简单的方法将其转换为 php4?
注意: 升级服务器不是由我决定的:(
I did this code for my own server in php5, but when I tried to deploy it, I found that the test and production server are php4 (my fault!). So I need to now who to convert this to run it in php4.
The following code works OK on php5:
<?php
$wsdl = 'http://blahblah:8081/services/LoginWebService?wsdl';
$client = new SoapClient($wsdl);
$params->username = 'an_user';
$params->password = 'a_pass';
$res = $client->login($params);
// ak auth key
$ak = $res->loginReturn;
echo $ak;
?>
Is there an easy way to translate it to php4?
NOTE: Is not up to me to decide upgrading the server :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用NuSOAP。
NuSOAP 是 SOAPx4 的重写,由 NuSphere 和 Dietrich Ayala 提供。它是一组 PHP 类(无需 PHP 扩展),允许开发人员创建和使用基于 SOAP 1.1、WSDL 1.1 和 HTTP 1.0/1.1 的 Web 服务。
Use NuSOAP.
NuSOAP is a rewrite of SOAPx4, provided by NuSphere and Dietrich Ayala. It is a set of PHP classes - no PHP extensions required - that allow developers to create and consume web services based on SOAP 1.1, WSDL 1.1 and HTTP 1.0/1.1.