Jump to content

Simplexml Problem


selenin

Recommended Posts

Hi I want the icon of a digg user

 

$apicall = 'http://services.digg.com/2.0/user.getInfo?usernames='.$username.'&type=xml';

    $result = simplexml_load_file($apicall);

      print_r($result);

 

With that code I'll get this:

 

            SimpleXMLElement Object

(

    [count] => 1

    [users] => SimpleXMLElement Object

        (

            [Ericquits] => SimpleXMLElement Object

                (

                    [username] => Ericquits

                    [about] => SimpleXMLElement Object

                        (

                        )

 

                    [user_id] => 20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e

                    [name] => Eric Quit

                    [icons] => SimpleXMLElement Object

                        (

                            [item] => Array

                                (

                                    [0] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/c.4164547322.png

                                    [1] => http://cdn1.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/h.4164547322.png

                                    [2] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/m.4164547322.png

                                    [3] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/l.4164547322.png

                                    [4] => http://cdn1.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/p.4164547322.png

                                    [5] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/s.4164547322.png

                                    [6] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/r.4164547322.png

                                )

 

                        )

 

                    [gender] => SimpleXMLElement Object

                        (

                        )

 

                    [diggs] => 12

                    [comments] => 1

                    [followers] => 373

                    [location] => SimpleXMLElement Object

                        (

                        )

 

                    [following] => 235

                    [submissions] => 9

                    [icon] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/p.4164547322.png

                )

 

        )

 

    [title] => Info for users Ericquits

    [timestamp] => 1320350425

    [uri] => http://services.digg.com/2.0/user.getInfo?usernames=Ericquits&type=json

    [cursor] => SimpleXMLElement Object

        (

        )

 

    [version] => 2.0

    [authorized] => 0

    [data] => users

    [method] => user.getInfo

    [user] => None

 

So I want the icon the profile image of the user and I make this:

 

print (string)$result->users->Ericquits->icon;

 

This works, but my question is if there is a solution to get the icon without Ericquits the username? Because if write it little I don't get the icon...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.