Php 使用file_get_contents函数,我想获得前几个google结果,而不是全部结果
我已经使用文件获取内容来获取字符串的google结果并显示到网页上Php 使用file_get_contents函数,我想获得前几个google结果,而不是全部结果,php,file-get-contents,Php,File Get Contents,我已经使用文件获取内容来获取字符串的google结果并显示到网页上 $url = "http://www.google.com/search?q=".$str; $result = file_get_contents($url); echo $result; 但是是否可以只显示前几个结果,比如5个,而不是所有结果?要限制Google搜索结果的数量,请在Google查询中添加参数&num=5 比较
$url = "http://www.google.com/search?q=".$str;
$result = file_get_contents($url);
echo $result;
但是是否可以只显示前几个结果,比如5个,而不是所有结果?要限制Google搜索结果的数量,请在Google查询中添加参数
&num=5
比较