PHP Curl example of the users/show method

Asked by michaelmorriss

Hello,

Could anyone show me a PHP Curl code example to use the users/show API method?

I've tried alot, but I don't know how to fix it.

Thank you,
Michael

Question information

Language:
English Edit question
Status:
Solved
For:
Jisko Edit question
Assignee:
No assignee Edit question
Solved by:
michaelmorriss
Solved:
Last query:
Last reply:
Revision history for this message
Marcos Garcia (marcosgdf) said :
#1

This should work:

<?php

$ch = curl_init('http://192.168.1.165/30/api/users/show/operador.xml');
curl_setopt($ch, CURLOPT_USERPWD, "operador:e5b630494fee6e22");
curl_exec($ch);

?>

Revision history for this message
michaelmorriss (mrxqware) said :
#2

Wow, thank you for the quick answer,

How can I print the profile picture for example?

Thank you
Michael

Revision history for this message
Marcos Garcia (marcosgdf) said :
#3

You have to parse XML, for example:

<?php

$ch = curl_init('http://192.168.1.165/30/api/users/show/operador.xml');
curl_setopt($ch, CURLOPT_USERPWD, "operador:e5b630494fee6e22");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($ch);

if ($return) $xml = new SimpleXMLElement($return);

echo $xml->profile_image_url;

?>

It will return:

http://gravatar.com/avatar/.....jpg?s=48

On Sun, Jun 13, 2010 at 7:04 PM, michaelmorriss <
<email address hidden>> wrote:

> Question #114470 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/114470
>
> Status: Answered => Open
>
> michaelmorriss is still having a problem:
> Wow, thank you for the quick answer,
>
> How can I print the profile picture for example?
>
> Thank you
> Michael
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
michaelmorriss (mrxqware) said :
#4

Yahoo! It works, Thanx alot!!

Revision history for this message
Marcos Garcia (marcosgdf) said :
#5

You're welcome :D

On Sun, Jun 13, 2010 at 7:39 PM, michaelmorriss <
<email address hidden>> wrote:

> Question #114470 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/114470
>
> Status: Answered => Solved
>
> michaelmorriss confirmed that the question is solved:
> Yahoo! It works, Thanx alot!!
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>