Return to Snippet

Revision: 37128
at December 4, 2010 08:18 by fackz


Initial Code
/* gets the 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;
}

$returned_content = get_data('http://www.somedomain.com');

echo $returned_content;

Initial URL


Initial Description


Initial Title
gets the data from a URL

Initial Tags
curl, data

Initial Language
PHP