mr.n0peC mr.n0peC - 3 months ago 8x
PHP Question

How do I post this JSON data with PHP? This JSON diferent

This is JSON data

{"clanSearch":{"results":[{"tag":"#G90G8RCU","name":"","type":"open","locationName":"Indonesia","clanBadgeImg":{"s":", 2x","m":", 2x","l":"","xl":""},"warFrequency":"always","clanLevel":1,"clanPoints":6867,"warWins":0,"requiredTrophies":0,"members":12}]}}

Here is the link

and my PHP code

$json = json_decode(file_get_contents(""));
$info = "$json->{'tag'}";
echo $info;

In this case, I want to get tag data, but if I run this script I get nothing.

$json = json_decode(trim(file_get_contents("url",true)));
$info =  $json['clanSearch']['results'][0]['tag'];
echo $info;

Usetrue flag and the hole data is converted to arrays with sub arrays

If you dont use true you have to get it with: