从Google API获取商业发行的免费图片

时间:2017-02-01 12:58:09

标签: php html google-api

我想在我的应用中使用Google API获取图片。基于某些关键字,我想获得仅用于商业用途的免费图片。

有可能吗?我必须向Google或图片所有者提供信用吗?我可以下载图片吗?

foreach ($images as $i) {
    $image = rawurlencode($i);
    $query = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=".$image."&imgsz=large&as_filetype=jpg";

    $json = get_url_contents($query);
    $data = json_decode($json);
    $results = array(); //define array here!
    foreach ($data->responseData->results as $result) {
        $results[] = array("url" => $result->url, "alt" => $result->title);
    }

    echo $results[0]['url'];
    echo "<br />";
    echo $query;
    echo "<br />";
}

1 个答案:

答案 0 :(得分:-1)

您必须询问所有者,因为他们拥有图片的权利。