Skip to content

Instantly share code, notes, and snippets.

@pheeque
Created April 4, 2019 17:47
Show Gist options
  • Save pheeque/e6874c8878acf898c8983bbf0f2efdc3 to your computer and use it in GitHub Desktop.
Save pheeque/e6874c8878acf898c8983bbf0f2efdc3 to your computer and use it in GitHub Desktop.
Simple php get url function with curl
function get_contents($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment