Tip: Using cURL to fetch contents of a web page

Following is the cURL code to fetch contents of a web page

<?
	$request_url ='http://www.qualitycodes.com';
 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $request_url);	// The url to from where to fetch contents
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);	// We want to get the respone
	$result = curl_exec($ch);
	echo $result;
	curl_close($ch);
 ?>

 

More PHP tips