I am trying to get and display images sent in tweet using php through an entity parameter. I have include_entities in my url and you can see the objects in the returned json.
In my foreach loop, I do the following:
foreach($results as $result){ $media_url = $result->entities->media->media_url; $media_size_h = $result->entities->media->sizes->small->h; $media_size_w = $result->entities->media->sizes->small->w; ... }
However, this does not return anything.
For my conclusion, I have ...
if(strlen($media_url) > 0) { //format table for tweets with images } else { //format table for regular tweets }
And this is json ...
array(20) { [0]=> object(stdClass)#5 (21) { ... ["entities"]=> object(stdClass)#7 (4) { ["media"]=> array(1) { [0]=> object(stdClass)#8 (10) { ["type"]=> string(5) "photo" ["media_url"]=> string(38) "http://photourl.jpg" ... ["sizes"]=> object(stdClass)#9 (4) { ["thumb"]=> object(stdClass)#10 (3) { ["resize"]=> string(4) "crop" ["h"]=> int(150) ["w"]=> int(150) } ... }
Any ideas why this is not working? Any help is appreciated!
source share