Consuming web service with php

Hey all,

Sorry if this is a little dumbed down but I am trying to consume a web service using php5 with the soap library. I have been researching this for a few weeks now and understand how it all works, but I can’t find any useful articles or tutorials on how to actually code it. There seems to be a lot more documentation out there on doing this with .net than php.

Anyways, I don’t expect anyone to give me a full walkthrough but if anyone could point me to a good “webservices for dummies” kind of post or article, that would be great.

Just in case anyone wants to take a stab at it the api I am using is located here

Any help whatsoever is greatly appreciated


Awesome, thanks so much. Literally as you responded I just finished successfully creating a small app that connected to a web service that converted weight units. But your post definitely helps out a lot more.

While I am sure your way is better, whats the difference in calling the soapFunction this way.

$client = new SoapClient("some.wsdl");
 $params->a = $a;
 $params->b = $b;
 $params->c = $c;

$objectresult = $client->SoapFunction($params); 
$simpleresult = $objectresult->SoapFunctionResult;

As far as sandbox goes who know, still waiting for responses from them which is why I’ve been testing out other web services.

Anyways thanks so much, that was a big help.

I don’t have any authentication credentials or anything but this is the gist of it:

$soap = new SoapClient('',array('trace'=>1));

try {

	$response = $soap->__soapCall('activateCard',array(
	echo '<pre>',print_r($response),'</pre>';

} catch(SoapFault $e) {
	echo "<p>$e</p>";

Does the API offer a development sandbox – couldn’t find one through google?