Skip to content

Instantly share code, notes, and snippets.

@binaryreverse
Last active April 21, 2020 17:31
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 binaryreverse/1fa08126fc904bb286e50c506d9106ae to your computer and use it in GitHub Desktop.
Save binaryreverse/1fa08126fc904bb286e50c506d9106ae to your computer and use it in GitHub Desktop.
PHP fetch content from URL alternative with curl (instead of file_get_contents)
<?php
$url = 'http://xxxxxxxxxx.tld';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment