Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP文件在谷歌搜索中获取内容?_Php_File Get Contents - Fatal编程技术网

PHP文件在谷歌搜索中获取内容?

PHP文件在谷歌搜索中获取内容?,php,file-get-contents,Php,File Get Contents,我试图使用PHP返回Google搜索的结果HTML 比如说 <?php $file = file_get_contents('http://www.example.com',false); echo $file; ?> 将返回example.com的HTML内容。问题是,当我尝试在谷歌搜索URL上执行此操作时,例如,它从谷歌主页返回HTML,而不是“猫”的搜索结果 最简单的方法是什么?好的,我已经回答了我自己的问题。很抱歉如果我关闭Google Insant,它可以在URL上正

我试图使用PHP返回Google搜索的结果HTML

比如说

<?php
$file = file_get_contents('http://www.example.com',false);
echo $file;
?>

将返回example.com的HTML内容。问题是,当我尝试在谷歌搜索URL上执行此操作时,例如,它从谷歌主页返回HTML,而不是“猫”的搜索结果


最简单的方法是什么?

好的,我已经回答了我自己的问题。很抱歉如果我关闭Google Insant,它可以在URL上正常工作,比如


无论如何谢谢你

好的,我已经回答了我自己的问题。很抱歉如果我关闭Google Insant,它可以在URL上正常工作,比如


无论如何谢谢你

您需要此表单的URL:

http://www.google.com/search?q=cats


您正在使用的URL用于他们的新“即时搜索”

您需要此表单的URL:

http://www.google.com/search?q=cats


你使用的URL是他们新的“即时搜索”

你比我领先27秒:-)你比我领先27秒:-)