Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.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
Javascript 如何在curl中使用google图像搜索_Javascript_Shell_Curl - Fatal编程技术网

Javascript 如何在curl中使用google图像搜索

Javascript 如何在curl中使用google图像搜索,javascript,shell,curl,Javascript,Shell,Curl,我成功地做到了以下几点: <html> <body> <form action="https://www.google.com/searchbyimage/upload" METHOD="POST" enctype="multipart/form-data"> <input type="file" name="encoded_image"> <input type="Submit" name="sch" value="sch">

我成功地做到了以下几点:

<html>
<body>
<form action="https://www.google.com/searchbyimage/upload" METHOD="POST" enctype="multipart/form-data">
  <input type="file" name="encoded_image">
  <input type="Submit" name="sch" value="sch">
</form>
</body>
</html>
curl -i -F name=green.jpg -F filedata=@/home/roroco/Dropbox/img/green.jpg https://www.google.com/searchbyimage/upload
谷歌结果显示:


我希望在curl中按图像搜索怎么做?

您的表单名称与google image search要查找的值不匹配。您的工作测试HTML文件正在提交编码的_图像中的文件,并且还在输入按钮中提供sch,但是您正在提交filedata中的文件以及curl命令中的名称

这就是我在当地的工作:

curl-i-F sch=sch-F encoded_image=@path/to/my/imagefile.jpg


它也可以在不提供sch的情况下工作,但我保留它以与您的原始表单保持一致。

@xorspark是正确的,我应该使用以下代码:

curl -i -F sch=sch -F encoded_image=@path/to/my/imagefile.jpg https://www.google.com/searchbyimage/upload
我想告诉大家如何找到名称编码的图片,在谷歌图片搜索页面中,当我点击相机图标>上传图片时,表单上有名称编码的图片,如下所示:

<html>
<body>
<form action="https://www.google.com/searchbyimage/upload" METHOD="POST" enctype="multipart/form-data">
  <input type="file" name="encoded_image">
  <input type="Submit" name="sch" value="sch">
</form>
</body>
</html>
curl -i -F name=green.jpg -F filedata=@/home/roroco/Dropbox/img/green.jpg https://www.google.com/searchbyimage/upload