I have a set of data that looks like this when using print_r($var):
cbfunc({"query":{"count":"12","created":"2010-06-11T01:20:19Z","lang":"en-US"},"results":["\n 238.l.739089.t.4<\/team_key>\n 4<\/team_id>\n CHEE-HOO!!!<\/name>"]});
It looks like JSON to me, so I’ve tried to use json_decode but can’t get it right. My goal is to print the xml data found in “results”.
Any helpful pointers would be greatly appreciated.
Thanks to ZZ Coder’s response, I figured out the solution.
According to a comment on the json function at PHP. The JSONP needs to be converted to JSON (without padding) via a handy preg_replace…
Then, the JSON can be parsed to print the results data: