-1

I am displaying the places api data on my webpage using php and google places api. I have displayed the name, address and phone number successfully by giving place reference. Now i want to display the places photo of given place. i am using the following:

file_get_contents("https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRoAAAAQiZS7dkiWqMWPMmhidMrAH9CyZ3Q2hMwYENL_dW2h8e3d9euO-LZAIq3cbMPRIFvXzEGWDblLujlfP2g6z54OSngjcQ8zJkVcAAHyDk0zJxFhVXLd6cPO7E-jV2WK6P7LjFo8Uknj-2QSueyVBsSQhIQXLO7JEU-vWdshr3NfqyGWRoUmtUSVOWxSOKq4AzhKyUE_M_wHYI&sensor=false&key=MYKEY");

It return raw data. How i can display image of this place. if your put above url in address bar of browser and give the key, your will receive an image.

But i cant render it in my webpage using php or html.

Regards

brandonscript
  • 68,675
  • 32
  • 163
  • 220

1 Answers1

0

You can simply do:

$imageContent = file_get_contents("___YOURGMAPSURL___");
file_put_contents("map.jpg", $imageContent);
brandonscript
  • 68,675
  • 32
  • 163
  • 220