Created
July 17, 2012 20:27
-
-
Save dbarbar/3131828 to your computer and use it in GitHub Desktop.
Using curl to retrive a JSON URL and decode it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $apiurl = 'the url'; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $apiurl); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| $json = curl_exec($ch); | |
| curl_close($ch); | |
| $data = json_decode($json); | |
| var_export($data); | |
| exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment