Html 如果结果来自images.google.com,则回显是或否
我目前正在开发一个html/脚本,它使用google的图像搜索来简单地返回是或否。如果找到结果,我想我可以解析来自用户的信息(图像的URL)进入谷歌图像搜索URL字符串,但我不能确定什么变量,或者如何让脚本识别结果是否被找到。。。我为我的以下脚本道歉,因为我以前使用的唯一语言是ASP,但经验很少:Html 如果结果来自images.google.com,则回显是或否,html,google-image-search,Html,Google Image Search,我目前正在开发一个html/脚本,它使用google的图像搜索来简单地返回是或否。如果找到结果,我想我可以解析来自用户的信息(图像的URL)进入谷歌图像搜索URL字符串,但我不能确定什么变量,或者如何让脚本识别结果是否被找到。。。我为我的以下脚本道歉,因为我以前使用的唯一语言是ASP,但经验很少: <?php $action=$_REQUEST['action']; if ($action=="") /* display the contact form */ {
<?php
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Link to image:<br>
<input name="name"/><br>
</form>
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
if (($name==""))
{
echo "Please Enter a URL";
}
else{
echo "https://www.google.ca/searchbyimage?site=search&image_url=$name&as_sitesearch=jamesmorgan.ca&safe=images";
}
}
?>
链接到图像:
我也意识到我的次要echo命令没有任何作用,我在想,也许我可以使用header命令将它们重定向到google image网站,并显示结果,但理想情况下,我希望脚本能够识别是否有结果,我觉得我可能完全错了,提前感谢。,对于初学者,您可能希望首先检查第1行中是否设置了
$\u请求['action']
,例如isset()
函数
至于处理反馈,您可以尝试查看-这基本上允许您从特定页面获取HTML内容,您可以自己处理,等等
希望这有帮助!祝你好运