1
votes

This is frustrating the hell out of me!

I have retrieved a json from google places search api. I have retrieved the photo_reference and used it to get the photo like so

echo  '<img src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference='.$photo_reference.'&key='.$apikey.'"/>';

I get nothing visible in the browser. When i view source i have the html for the images there. If i put the href directly into the url bar it shows me the picture that in the documentation means that I have exceeded my quota. You can see here if you scroll down to "Place Photo Response" in this link to google docs

The thing is that I haven't exceeded my quota. I go to my Google API dashboard and go to quotas and it clearly says at this moment in time i have only made 19 queries. I can still query the places API no problem. I have to to get the photo reference.

So what the hell am I missing? All I can find is documentation of people who can work out how to parses the response but nothing about quotas.

2
Its a 403 redirect not 301. I posted to quickly.. more haste less speed ;-)Feels Unique
i have created a google report here code.google.com/p/gmaps-api-issues/issues/detail?id=10352 If you can think of any thing that could cause this please help because im not holding my breath for google to reply to me :/user6752532

2 Answers

1
votes

Any one else having this problem... Check to see if you have specified IP restrictions in your control panel. I have restricted the API access to my server but then when i was trying to display the image front end without caching the image server side first, of course the front end IP address (the users IP) is different to the server ip which is white listed. So to fix this, cache the image server side then display it, or remove the IP white list from the Google dev control panel.

1
votes

The "out of quota" image may also be caused by access to the Places API being denied, based on IP or referrer restrictions on your API key.

You would normally want to have an IP restriction on the API key you use for the Places API web service, so that it can only be used from your server. The same key cannot be used for the IMG tags, because requests will come form users' browsers, and be denied. You can create a separate API key, restricted to your site/s (referer/s) and use that in the IMG tags.