Skip to content

Instantly share code, notes, and snippets.

@iegorov
Created July 12, 2013 09:00
Show Gist options
  • Save iegorov/5982964 to your computer and use it in GitHub Desktop.
Save iegorov/5982964 to your computer and use it in GitHub Desktop.
Get json using CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http');
// curl_setopt($ch, CURLOPT_FAILONERROR, 1);
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($ch);
curl_close($ch);
$num = json_decode($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment