? Posted on December 25, 2009 by KC How can we make use of the php authority to get the source of "http://www.google.com" as the string, contend $html.
Id personaly recomend php Curl, its a great function of php. You can set it to do lots of stuff, such as fake the refferer!I use CURL a lot, and use it for google to find websites PR. Here is a snipit of what I use.<?php $url = "http://google.com";$curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,$url); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $html = curl_exec($curl_handle); curl_close($curl_handle);if (empty($html)){ print "Sorry, $url could not be found.<p>"; }else{ print $html; } ?>
Id personaly recomend php Curl, its a great function of php. You can set it to do lots of stuff, such as fake the refferer!
I use CURL a lot, and use it for google to find websites PR. Here is a snipit of what I use.
<?php
$url = "http://google.com";
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$url);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$html = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($html)){
print "Sorry, $url could not be found.<p>";
}else{
print $html;
}
?>