tags:

views:

43

answers:

1

I'm trying to extract some information from ebay api . I have this link up http://open.api.ebay.com/shopping?callname=GetMultipleItems&responseencoding=XML&appid=Morcovar-c74b-47c0-954f-463afb69a4b3&siteid=0&version=525&IncludeSelector=ItemSpecifics&ItemID=220617293997,250645537939,230485306218 and I'm using SimpleXML . So far I managed to extract all the info that I needed except the "PictureURL". The issue is that when I make a print to the simpleXMl it appears that the pictures are in an array

     [GalleryURL] => http://thumbs4.ebaystatic.com/pict/1105372138158080_1.jpg
                    [PictureURL] => Array
                        (
                            [0] => http://i.ebayimg.com/09/!Bt+mKZQCWk~$(KGrHqYH-CYEvrwcUC47BL-,(K(pnw~~_1.JPG?set_id=8800005007
                            [1] => http://i.ebayimg.com/01/!Bt+mDTwB2k~$(KGrHqUH-DEEvirheBYUBL-,WtytJQ~~_1.JPG?set_id=8800005007
                            [2] => http://i.ebayimg.com/22/!Bt+mE8!EGk~$(KGrHqUH-CMEvsjKcE3JBL-,Wzr+sw~~_1.JPG?set_id=8800005007
                            [3] => http://i.ebayimg.com/17/!Bt+mFg!EGk~$(KGrHqIH-DoEvp43,)33BL-,W14vYQ~~_1.JPG?set_id=8800005007
                            [4] => http://i.ebayimg.com/01/!Bt+mQ0!!2k~$(KGrHqIH-EQEvqDDLQZVBL-,(j1YGg~~_1.JPG?set_id=8800005007
                            [5] => http://i.ebayimg.com/01/!Bt+mSq!EGk~$(KGrHqQH-C4Evs(Rz(JWBL-,(rdtsw~~_1.JPG?set_id=8800005007
                            [6] => http://i.ebayimg.com/03/!Bt+mUBw!Wk~$(KGrHqEH-DEEvnQtM9VkBL-,(w1+lQ~~_1.JPG?set_id=8800005007
                            [7] => http://i.ebayimg.com/15/!Bt+mHKQEGk~$(KGrHqQH-E!Evlr98iwBBL-,W87Nug~~_1.JPG?set_id=8800005007
                            [8] => http://i.ebayimg.com/13/!Bt+mI3!Bmk~$(KGrHqMH-DkEvq1,F2ooBL-,(EQ7Vg~~_1.JPG?set_id=8800005007
                            [9] => http://i.ebayimg.com/05/!Bt+mL2gEWk~$(KGrHqIH-EYEvov7vQY4BL-,(PzCKQ~~_1.JPG?set_id=8800005007
                            [10] => http://i.ebayimg.com/24/!Bt+mNlwEWk~$(KGrHqIH-CYEvqPjh6RQBL-,(Wh+S!~~_1.JPG?set_id=8800005007
                            [11] => http://i.ebayimg.com/19/!Bt+mPE!!2k~$(KGrHqQH-CYEvr5z9)NVBL-,(c3bzw~~_1.JPG?set_id=8800005007
                        )

But if I try to get them from the array I get no result . Here is the code that I currently have

   $items = "220617293997,250645537939,230485306218,110537213815,180519294810";
   $number_of_items  =  count(explode(",", $items));
   $xml = $baseClass->getContent("http://open.api.ebay.com/shopping?callname=GetMultipleItems&responseencoding=XML&appid=Morcovar-c74b-47c0-954f-463afb69a4b3&siteid=0&version=525&IncludeSelector=ItemSpecifics,description&ItemID=$items");
   writeDoc($xml, "api.xml");

   $getvalues = simplexml_load_file('api.xml');
 $picture_url = $getvalue->Item[$number]->PictureURL[2];
echo "picture url is $picture_url";

Using the above code I was expecting to extract the 2nd picture url from the array . thank you in advance for any help !

A: 

Can't test this, I'm afraid, but have you tried var_dump($picture_url) to see what $picture_url is? Maybe it needs to be cast to string?

echo "picture url is" .  (string)$picture_url;
Manos Dilaverakis