如何使用PHP和解析从谷歌搜索结果页面解析前几个结果?

时间:2013-03-12 18:41:51

标签: php parsing http-get

这是我到目前为止所获得的内容,此代码只返回标题我无法返回其他任何重要的搜索结果

<?
include("LIB_parse.php");
include("LIB_http.php");


$var=$_POST['SearchText'];

$web_page = http_get($target="http://www.google.com/search?q=$var", $referer="");

$title_excl = return_between($web_page['FILE'], "<title>", "</title>", EXCL);



$result1_excl = return_between($web_page['FILE'], "<h3 class="r">", "</h3 class="r">", EXCL);

$resulttext_excl = return_between($web_page['FILE'], "<span class="st">", "</span class="st">", EXCL);



echo $title_excl;

?>

0 个答案:

没有答案