i need some help geting some data from JSON to php, i have tried a lot of options, but can’t get the results i need, please can some one of you help.
The data can be fetched by a url.
Here is the data from the url: a:5:{i:0;s:3:"135";i:1;s:3:"177";i:2;s:3:"178";i:3;s:3:"166";i:4;s:3:"165";}
I need to get the numbers that are inside the “” , example 135, and the numbers after i’s, example i:0, i:1 etc
Here is the code i have tired:
$string = file_get_contents("http://www.myweb.com/url.php?url=1");
$json_a=json_decode($string,true);
echo $json_a['a:5']['i'];
I cant get any result.
a:5:{i:0;s:3:"135";i:1;s:3:"177";i:2;s:3:"178";i:3;s:3:"166";i:4;s:3:"165";}This looks like a serialized string by
serializefunction of PHP.Try
unserialize. Here: http://php.net/unserializeYour data output;
Array ( [0] => 135 [1] => 177 [2] => 178 [3] => 166 [4] => 165 )