简体   繁体   English

在Php中搜索Google Image

[英]Google Image search in Php

I'm trying to use google images api with PHP, and I'm really not sure what to do. 我正在尝试使用PHP的谷歌图像API,我真的不知道该怎么做。

I have written the following Code 我写了以下代码

<?php
$url = "https://ajax.googleapis.com/ajax/services/search/images?".
"v=1.0&q=indian%20institue%20of%20techology";
$jk=file_get_contents($url);
$json = json_decode($jk, true);
echo $json["responseData"]["results"][0]["url"];
?>

I wish to find the url of 1st Image from image search. 我希望从图像搜索中找到第一张图像的网址。 I'm not getting any result when using the script. 使用脚本时我没有得到任何结果。

Google has retired the image search API, it is no longer available ( see this SO thread with alternatives ). 谷歌已退出图像搜索API,它已不再可用( 请参阅此SO线程与替代品 )。

If you open up the URL you provided it will say this: 如果你打开你提供的URL,它会说:

{"responseData": null, "responseDetails": "This API is no longer available.", "responseStatus": 403}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM