0

Possible Duplicate:
Parse Json in php

I was looking for this awnser but couldnt find it... so here is the question

How can I get the information from https://graph.facebook.com/XXXXXXX into vars, from this:

{
   "id": "XXXXXXX",
   "name": "Ricardo Capistran",
   "first_name": "Ricardo",
   "last_name": "Capistran",
   "username": "richycapy",
   "gender": "male",
   "locale": "es_LA"
}

Into this vars:

$id, $name, $firstname, $lastname, $username, $gender, $locale
Community
  • 1
  • 1

1 Answers1

4
$data = json_decode($from);
extract($data);
  • JSON Decode - Takes a JSON encoded string and converts it into a PHP variable.
  • Extract - Import variables into the current symbol table from an array
Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68