Cannot retrieve media_url (php)

restapi
media
php

#1

Hi there
I’m using REST API
user_timeline.json and I already added &tweet_mode=extended

$json= $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);

$string = json_decode($json)

if I print $json I can see entities->media->media_url with an actual url to my image, but looping on the messages i can get some information except for media ones

foreach($string as $items)
{
        echo "Time and Date of Tweet: ".$items['created_at']."<br />";   OK
        echo "Tweet: ". $items['text']."<br />";                                      OK
        echo "Screen name: ". $items['user']['screen_name']."<br />";    OK
        echo "Followers: ". $items['user']['followers_count']."<br />";       OK
	echo "media_url-->: ". $items['entities']['media']['media_url']."<br />";  NOTHING
	echo "url-->: ". $items['entities']['media']['url']."<br />"; NOTHING
	echo "media_url_https-->: ". $items['entities']['media']['media_url_https']."<br />"; NOTHING
    }

Hope I’ve been enough clear :slight_smile:
thank you all


#2

found myself:
echo "media_url–>: ". $items[‘entities’][‘media’][0][‘media_url’]