function HttpGet( $url, $followRedirects=true ) {
$arr_user_aggents = array();
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$arr_user_aggents[] = 'Opera/9.20 (Windows NT 5.0; U; en)';
$arr_user_aggents[] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)';
$arr_user_aggents[] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts; .NET CLR 1.1.4322; ZangoToolbar 4.8.2; IEMB3; IEMB3)';
$arr_user_aggents[] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)';
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$arr_user_aggents[] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)';
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11';
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2';
$arr_user_aggents[] = 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML\, like Gecko) Safari/419.3';
$arr_user_aggents[] = 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9.1 (KHTML\, like Gecko) Safari/419.3';
$arr_user_aggents[] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$arr_user_aggents[] = 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11';
$arr_user_aggents[] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)';
//find user agent
$randomuser_agent = mt_rand(0,count($arr_user_aggents));
$full_curl = false;
if (function_exists('curl_exec')){
$chx = curl_init();
$full_curl = @curl_setopt ($chx, CURLOPT_FOLLOWLOCATION,1);
curl_close($chx);
}
if (!$full_curl){
$rtn = httpGet_fsockopen($url,$arr_user_aggents[$randomuser_agent]);
}else{
$rtn = httpGet_curl($url,$arr_user_aggents[$randomuser_agent]);
}
return $rtn;
}
function httpGet_fsockopen($url,$user_agent){
$url_parsed = parse_url($url);
if ( empty($url_parsed['scheme']) ) {
$url_parsed = parse_url('http://'.$url);
}
$rtn['url'] = $url_parsed;
$port = $url_parsed["port"];
if ( !$port ) {
$port = 80;
}
$rtn['url']['port'] = $port;
$path = $url_parsed["path"];
if ( empty($path) ) {
$path="/";
}
if ( !empty($url_parsed["query"]) ) {
$path .= "?".$url_parsed["query"];
}
$rtn['url']['path'] = $path;
$host = $url_parsed["host"];
$foundBody = false;
$out = "GET $path HTTP/1.0\r\n";
$out .= "Host: $host\r\n";
$out .= "user-agent: ".$user_agent;
$out .= "Connection: Close\r\n\r\n";
if ( !$fp = @fsockopen($host, $port, $errno, $errstr, 30) ) {
$rtn['errornumber'] = $errno;
$rtn['errorstring'] = $errstr;
return $rtn;
}
fwrite($fp, $out);
while (!feof($fp)) {
$s = fgets($fp, 128);
if ( $s == "\r\n" ) {
$foundBody = true;
continue;
}
if ( $foundBody ) {
$body .= $s;
} else {
if ( ($followRedirects) && (stristr($s, "location:") != false) ) {
$redirect = preg_replace("/location:/i", "", $s);
return HttpGet( trim($redirect) );
}
$header .= $s;
}
}
fclose($fp);
$__ = explode("\n",$header);
$___ = explode(" ",$__[0]);
$rtn['header'] = ($header);
$rtn['http_code'] = trim($___[1]);
$rtn['http_header'] = trim($__[0]);
$rtn['body'] = trim($body);
return $rtn;
}
function httpGet_curl($url,$user_agent){
$chx = curl_init();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; // browsers keep this blank.
$timeout = 100;
curl_setopt ($chx, CURLOPT_URL, $url);
curl_setopt ($chx, CURLOPT_HEADER, 0);
curl_setopt ($chx, CURLOPT_HTTPHEADER, $header);
curl_setopt ($chx, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($chx, CURLOPT_FOLLOWLOCATION,1);
curl_setopt ($chx, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($chx, CURLOPT_TIMEOUT, $timeout);
curl_setopt ($chx, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($chx, CURLOPT_VERBOSE,1);
$resultx = curl_exec ($chx);
$curl_info = curl_getinfo($chx);
curl_close($chx);
$rtn = array();
$rtn['http_code'] = $curl_info['http_code'];
$rtn['body'] = trim($resultx);
return $rtn;
}
?>
Data Recovery Software Services | iLostData
|
|
To begin,
Please select media type and click Next button: |
|
|
 |
|
|
| Data Recovery Services and Software |
|
|
|
|
|
|
|
| Copyright © 2003-2006 iLostData.com |
|
|
|