note 86997 modified in function.json-decode by danbrown
| From: | danbrown@php.net | Date: | Fri, 14 Nov 2008 04:25:44 +0000 |
| Subject: | note 86997 modified in function.json-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146512@lists.php.net to get a copy of this message | ||
Make sure you pass in utf8 content, or json_decode may error out and just return a null value. For
a particular web service I was using, I had to do the following:
<?php
$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$results = json_decode($contents);
?>
Hope this helps!
--was--
Make sure you pass in utf8 content, or json_decode may error out and just return a null value. For
a particular web service I was using, I had to do the following:
$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$results = json_decode($contents);
Hope this helps!
http://php.net/manual/en/function.json-decode.php