Skip to content

Instantly share code, notes, and snippets.

@roelven
Created April 19, 2010 12:26
Show Gist options
  • Save roelven/370985 to your computer and use it in GitHub Desktop.
Save roelven/370985 to your computer and use it in GitHub Desktop.
<?php
// Don't like fopen(), use curl to get contents
function get_url($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$content = curl_exec($ch);
curl_close($ch);
return $content;
};
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment