Skip to content

Instantly share code, notes, and snippets.

@digitalhydra
Created December 13, 2013 16:17
Show Gist options
  • Save digitalhydra/7946703 to your computer and use it in GitHub Desktop.
Save digitalhydra/7946703 to your computer and use it in GitHub Desktop.
curls fuction to get data from a url
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$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