1
votes

We are attempting to use the Google Place Photo Requests

(https://developers.google.com/places/documentation/photos#place_photo_requests)

API to fetch photos, but are constantly getting the quota exceeded image.

We have signed up for a paid account, as well as set up a brand new account, and continue to get this error.

To reproduce we:

1) First ran the Place Details request from the server (/maps/api/place/details/json) via PHP.

2) Then from this result set we fetched the (['result']['photos'][0]['photo_reference']) photoreference.

3) With the photoreference, key, sensor and maxwidth variables we called /maps/api/place/photo (via PHP).

We can not seem to get this to work. Has anybody else successfully used this or has any advice?

2
Did you ever solve this? I get the same and see it mentioned a lot even 8 years laterWayneio

2 Answers

0
votes

Sounds like you are either sending us a lot of requests, or you aren't adding your key to the photo fetch. Have you had any successful requests? If not, I'd suspect your keys are missing and/or incorrect.

0
votes

Try this code.. It works for me

<h3>Images From Google </h3>
<?php

$company_name = 'walmart';
$data_ref = file_get_contents("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=Latitude ,Longitude&radius=100&name=".$company_name."&types=store&sensor=false&key=MYKEY");


$data_ref_de = json_decode($data_ref);

if($data_ref_de->status=='OK')
{


    foreach($data_ref_de->results as $result)
    {
        if(isset($result->photos) && count($result->photos))
        {
            foreach($result->photos as $photos)
            {?>
               //Display Image

            <img src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=600&photoreference=<?php echo $photos->photo_reference; ?>&sensor=true&key=MYKEY" />

            <?php 
            }
        }
    }

}

And also be sure that you have enabled the Places API Service