Thursday, 15 March 2012

How can i parse this json using php? -



How can i parse this json using php? -

here json string:

{ "id": "100007460521803_1498098053782198" }

i want display id.. im using code unsuccessfully:

$json = file_get_contents('id.txt'); $decode = json_decode($json); echo $decode->id;

error:

fatal error: cannot utilize object of type stdclass array in /home/xtremepi/public_html/who-viewed/test.php on line 6

any ideas?

i have checked , got code working. have create sure id.txt file in same directory. or seek replace

echo $decode->id;

by one

echo $decode['id'];

php json

No comments:

Post a Comment