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 :(
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.
精彩评论