Skip to content

Instantly share code, notes, and snippets.

@cam-gists
Created June 7, 2012 21:44
Show Gist options
  • Save cam-gists/2891732 to your computer and use it in GitHub Desktop.
Save cam-gists/2891732 to your computer and use it in GitHub Desktop.
PHP: cURL Scrape Page
<?php
/*
PHP: cURL Scrape page
*/
function getData($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);
return $contents;
}
//Usage
echo getData('www.google.com');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment