Most popular web services such as twitter provide data through open APIs. It always knows how to parse various transmission formats of API data, including JSON, XML, etc.
代码如下 | 复制代码 |
$json_string='{"id":1,"name":"foo","email":"foo@foobar.com","interest":["wordpress","php"]} '; $obj=json_decode($json_string); echo $obj->name; //prints foo echo $obj->interest[1]; //prints php |