我必须从Google抓取数据。
例如,此URL:
https://www.google.com/searchbyimage?&image_url=https://traum-deutung.de/wp-content/uploads/2016/04/traumdeutung-offener-sarg-symbol-768x768.jpg
但是当我抓取它并回显数据变量时,它只是向我显示了Google页面,如下所示:
这是来自Google图片搜索的实际结果,但是我没有在我的PHP脚本中找到其代码:
我为此使用的代码
<?php
require 'simple_html_dom.php';
$link = $_GET['link'];
if (!isset($link) || empty($link)) {
echo "please provide a link". "<br> \n";
echo "EXAMPLE : <br>";
echo "example.com?link=HERE PUT IMAGE LINK";
die();
}
$html = file_get_html('https://www.google.com/searchbyimage?&image_url='. $link);
echo $html;
?>