7
votes

I'm trying to access Places photos using the photoreference.

This works:

https://maps.googleapis.com/maps/api/place/photo?maxwidth=800&photoreference=CnRsAAAAGrxlcgShBlZZJgAFxr19eT3fQKxeDTpN4HtyCIsUpOHjUPqB_tm_J_Rf9sbwyWU1j4_SSRWyFiIT0TYGDSn6mAwAQ6ep-9Rok0kAEf6LewL8CRYbaEVoEsfrZXs_BIwUcqNs5p1TQv-EMt-PO8RloBIQHF40AvYJVknRixv4uFYVVRoUGKN_fqy7qynsrclqkBbAdaIpi58&key=MY_KEY

But this one doesn't:

https://maps.googleapis.com/maps/api/place/photo?maxwidth=800&photoreference=CnRnAAAADBlPZditZugHCXmMtb0_qQqwyh3rJ0ByTxnI_MRXXEB7Cj_I1QgTKi7XMUAXbD3YMEH8yPdfIH-u-uoM0ZnMsLY6l0eF0Ip9JTkqkw5tgE_eD6RUhgOztHJ312JRWIFkJq2faixmtTM4DILp4WsWaRIQQy53oVWAfP68T60TsYQSNxoUZDjyv0kLie1ZGNzDrF2YgqqktWo&key=MY_KEY

Both photoreferences are valid. I can access about 50% of the pictures, the other 50% gives me a 403 error. I have a paid license key, and am not over the limit (anyway it's not that the first 50% works and then it gives 403, but quite random, some work, some don't).

Any ideas?

2
Did you figure this out? - Levi Botelho
No, I raised a ticket with Google, will give an update if they come back to me - Geza
The answer from google: After reviewing the information you provided in relation to forbidden 403 statuses for photo references in Places API, we believe that you may be affected by an internal issue on our end (#19376901). I've added your Places API project number and information related to this case to this internal issue. - Geza
I'll file an issue as well. Thanks for the info! - Levi Botelho
I‘m still seeing this behavior in 2020! Did Google ever try to fix it? - morgler

2 Answers

1
votes

The photo seems to have been removed (or made private) by its owner.

Your 2nd Places Photo request (link) returns a redirect:

HTTP/1.1 302 Found Location: https://lh5.googleusercontent.com/-gMRov-DClsg/UkYcLUa5mtI/AAAAAAAAJiI/48Zbe7GvS9I/s1600-w800/photo.jpg

The response for that photo.jpg URL is simply HTTP 404 Not Found.

0
votes

Try to get the image with php function: file_get_contents