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
https://forums.phpfreaks.com/topic/250399-simplexml-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.