views:

35

answers:

1

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 :(

+3  A: 

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.

shamittomar
Nusoap is a great decision, but I recommend you use the interface Nusoap_Client to do the requests... This will help you in the future when have been necessary upgrade the version of php to 5.
Felipe Cardoso Martins