note 86997 deleted from function.json-decode by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 15:02:35 +0000 |
| Subject: | note 86997 deleted from function.json-decode by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215448@lists.php.net to get a copy of this message | ||
Note Submitter: Aaron Kardell
----
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!