I can grab "text" for example with the code below, but how can I grab the username "Lionek_Gaming" under includes > user ?
$tweets = json_decode($response);
foreach($tweets->data as $tweet) {
$text = $tweet->text;
echo $text;
}
Json response
{
"data": [
{
"author_id": "1169144412171055104",
"id": "1386731275160072192",
"text": "sell Bitcoin at sweet rates"
}
],
"includes": {
"users": [
{
"id": "1304731585112158209",
"name": "Lionek_official #BRG",
"username": "Lionek_Gaming"
}
]
},
}
Try the following:
foreach($tweets->includes->users as $user) {
$username = $user->username;
echo $username;
}