0

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

BlogueroConnor
  • 1,893
  • 4
  • 17
  • 18
  • That probably depends on how the `SoapClient` class is defined. I assume it is defined to work with PHP5 and you would have to change this to PHP4 if possible. – Felix Kling Sep 03 '10 at 20:13
  • What you really should do is to upgrade to PHP 5. PHP 4 is a really, really dead horse. Its support [ended in 2008](http://stackoverflow.com/questions/1734072/official-end-of-support-for-php4). – Pekka Sep 03 '10 at 20:14

1 Answers1

3

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
  • 46,210
  • 12
  • 74
  • 78
  • 1
    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 Sep 03 '10 at 20:26