Skip to content

Instantly share code, notes, and snippets.

@ArjanBas
Last active January 14, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArjanBas/3de2d0aeff190ef33b08ce24ea8b00bf to your computer and use it in GitHub Desktop.
Save ArjanBas/3de2d0aeff190ef33b08ce24ea8b00bf to your computer and use it in GitHub Desktop.
Read https content from url by using curl (php)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla 5.0');
$content = curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment