Skip to content

Instantly share code, notes, and snippets.

@fixable11
Created August 28, 2018 16:18
Show Gist options
  • Save fixable11/fcb7039185ea30b157aff4f0a9462527 to your computer and use it in GitHub Desktop.
Save fixable11/fcb7039185ea30b157aff4f0a9462527 to your computer and use it in GitHub Desktop.
function curl_get($url, $referer = 'https://www.google.com'){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36');
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo curl_get('https://site.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment