FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Looping through Web Service results
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Looping through Web Service results [message #172220] Sat, 05 February 2011 05:03 Go to next message
BigNate is currently offline  BigNate
Messages: 7
Registered: February 2011
Karma: 0
Junior Member
Hi Folks
I'm having trouble displaying individual values of my SOAP results. I'm using the code below to connect to the web service:

$client = new SoapClient($urlWSDL);
$result = $client->getVotes($userKey);

I can see that it returns an array, using the dBug script, I can see everything in there, but I can't figure out how to loop through the array to see the individual columns. I'm used to looping through an array returned from a MySQL result with those functions, so I'm stuck with this one. Does anyone have any ideas? Any help would be greatly appreciated.

Thanks,

Nate
Re: Looping through Web Service results [message #172223 is a reply to message #172220] Sat, 05 February 2011 10:18 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 05-02-11 06:03, BigNate wrote:
> Hi Folks
> I'm having trouble displaying individual values of my SOAP results. I'm using the code below to connect to the web service:
>
> $client = new SoapClient($urlWSDL);
> $result = $client->getVotes($userKey);
>
> I can see that it returns an array, using the dBug script, I can see everything in there, but I can't figure out how to loop through the array to see the individual columns. I'm used to looping through an array returned from a MySQL result with those functions, so I'm stuck with this one. Does anyone have any ideas? Any help would be greatly appreciated.
>
> Thanks,
>
> Nate

http://www.php/net/foreach

Try to create something with the info on that link, and i you get stuck
someone here might point you further on the path, if you show what you
did with that info....

--
Luuk
Re: Looping through Web Service results [message #172228 is a reply to message #172223] Mon, 07 February 2011 04:50 Go to previous message
BigNate is currently offline  BigNate
Messages: 7
Registered: February 2011
Karma: 0
Junior Member
Thanks, here is what worked for me:

foreach ($result as $item) {
echo $item->id;
echo $item->name;
}
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: validating / converting time for insertion into mysql DB??
Next Topic: Why doesn't this work?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 03:00:13 GMT 2024

Total time taken to generate the page: 0.02699 seconds