I send a curl request on facebook api and i am getting this response.
'{
"id": "137392510101234",
"email": "[email protected]",
"first_name": "Open",
"last_name": "User",
"link": "https://www.facebook.com/app_scoped_user_id/137392510108522/",
"name": "Open Graph Test User"
}'
Now i am trying to read the value of id. I used below code for it.
$jsonid='{
"id": "137392510101234",
"email": "[email protected]",
"first_name": "Open",
"last_name": "User",
"link": "https://www.facebook.com/app_scoped_user_id/137392510108522/",
"name": "Open Graph Test User"
}';
$jsonArrayToken = json_decode($jsonid,true);
echo $jsonArrayToken['id'];
But i cant read the whole value of id.
i am getting only first four digits “1373”.
i want whole id “137392510101234”.
Is there any mistake? please suggest me.
3
Answers
working fine check here:
eval link :
https://eval.in/734713
May be problem is some where else not in this code
json_decode
provides an object, not an array. You should access the data like following :I just copied your code added var_export, no problem found.
Response: