0

how to get foreach the belos json_encode data.. I am looking to get this data into foreach and then save into mysql.

[
{
"trends":[
{
name:"#PondyWelcomesTHALAPATHY",
url:"http:\/\/twitter.com\/search?q=%23PondyWelcomesTHALAPATHY",
promoted_content:null,
query:"%23PondyWelcomesTHALAPATHY",
tweet_volume:100685
},
{
name:"#SaamySquareFromSep21",
url:"http:\/\/twitter.com\/search?q=%23SaamySquareFromSep21",
promoted_content:null,
query:"%23SaamySquareFromSep21",
tweet_volume:null
},
],
"as_of":"2018-09-14T14:19:50Z",
"created_at":"2018-09-14T14:13:53Z",
"locations":[
{
name:"Mumbai",
woeid:2295411
}
]
}
]
subbun
  • 11
  • 6
  • I have tried few ways, but did not success.. so any one provide some pice of php code for this to get the name, url into foreach loop. – subbun Sep 14 '18 at 15:07
  • I found the solution for this json data.. $arr = array_values( $object ); $count=sizeof($arr[0]->trends); echo $count; echo ""; for($i=0;$i<$count;$i++) { echo ""; echo $arr[0]->trends[$i]->name; } – subbun Sep 14 '18 at 15:27

0 Answers0