关于偷取sohu搜索结果的方法核心
这里只是给出核心:
<html><head><title>Goto-PHP Version! :: Searcher</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css"></head><body bgcolor="#FFFFFF">
<?
$p="http://searchbaidu.sohu.com/cgi-bin/search_baidu.pl?word=$kw&ct=0&lm=0&si=gi&cl=2&rn=10&tn=sohu&pn=";
if(empty($page))$page=1;
$pn=($page-1)*10;
$fp=fopen($p.$pn,"r");
$result=fread($fp,1000000);
fclose($fp);
preg_match("/为您找到 (\d+) 个查询结果/i",$result,$temp);
$num=$temp[1];
$result=eregi_replace("<html>.*<!--here to print the result of the search !-->","",$result);
$result=eregi_replace("<!--here end of result of search !-->.*<\/HTML>","",$result);
echo $num;
echo $result;
?>
</body></html>
|