Ok, so im working with tumblr's API and im using SimpleXMLElement with php and ive run into a problem.
Basically, when I call on a variable it just prints a zero.
for instance :
<?php echo $data->posts->post[0]->photo-url[5]; ?>
This just breaks the page, and when I leave out the [5] it just prints zero
I want to echo the photo-url with the number [5] but I cant get my head around this and its killing me. I just dont understand why it wont work.
Heres a sample of the simpleXMLElement print-out :
SimpleXMLElement Object
( [@attributes] => Array ( [version] => 1.0 )
[posts] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => photo
)
[post] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 574166180
[url] => http://young-n-reckless.tumblr.com/post/574166180
[url-with-slug] => http://young-n-reckless.tumblr.com/post/574166180
[type] => photo
[date-gmt] => 2010-05-05 19:52:46 GMT
[date] => Wed, 05 May 2010 15:52:46
[unix-timestamp] => 1273089166
[format] => html
[reblog-key] => vc9EfT7d
[slug] =>
[tumblelog] => young-n-reckless
[bookmarklet] => true
)
[tumblelog] => SimpleXMLElement Object
(
[@attributes] => Array
(
[title] => Young & Reckless
[name] => young-n-reckless
[url] => http://young-n-reckless.tumblr.com/
[timezone] => US/Eastern
[avatar-url-16] => http://24.media.tumblr.com/avatar_424f776dd55c_16.png
[avatar-url-24] => http://24.media.tumblr.com/avatar_424f776dd55c_24.png
[avatar-url-30] => http://24.media.tumblr.com/avatar_424f776dd55c_30.png
[avatar-url-40] => http://25.media.tumblr.com/avatar_424f776dd55c_40.png
[avatar-url-48] => http://24.media.tumblr.com/avatar_424f776dd55c_48.png
[avatar-url-64] => http://26.media.tumblr.com/avatar_424f776dd55c_64.png
[avatar-url-96] => http://25.media.tumblr.com/avatar_424f776dd55c_96.png
[avatar-url-128] => http://24.media.tumblr.com/avatar_424f776dd55c_128.png
[avatar-url-512] => http://29.media.tumblr.com/avatar_424f776dd55c_512.png
)
)
[photo-link-url] => http://www.flickr.com/photos/katiemabey/3429588812/
[photo-url] => Array
(
[0] => http://30.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_500.jpg
[1] => http://30.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_500.jpg
[2] => http://25.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_400.jpg
[3] => http://28.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_250.jpg
[4] => http://30.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_100.jpg
[5] => http://30.media.tumblr.com/tumblr_l1w1qd7Zcg1qatgoto1_75sq.jpg
)
)
Any help would be greatly appreciated, and thanks in advance. Warren