Get reviews from google map api
A more recent way to do this:
https://maps.googleapis.com/maps/api/place/details/json?placeid={place_id}&key={api_key}
- place_id: https://developers.google.com/places/place-id
- api_key: https://developers.google.com/places/web-service/get-api-key
Response:
{
"html_attributions": [],
"result": {
...
"rating": 4.6,
"reviews": [
{
"author_name": "John Smith",
"author_url": "https://www.google.com/maps/contrib/106615704148318066456/reviews",
"language": "en",
"profile_photo_url": "https://lh4.googleusercontent.com/-2t1b0vo3t-Y/AAAAAAAAAAI/AAAAAAAAAHA/0TUB0z30s-U/s150-c0x00000000-cc-rp-mo/photo.jpg",
"rating": 5,
"relative_time_description": "in the last week",
"text": "Great time! 5 stars!",
"time": 1508340655
}
]
}
}
Reviews are limited to the 5 latest.
$reqUri = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?key='.YOURSERVERKEY;
$reqUri .= '&sensor=false&radius=500';
$reqUri .= '&location=38.908310,-104.784035&name='.urlencode(LOCATION NAME);
$reqUri .= '&keyword='.urlencode(WEBSITE PHONE);
I made it through PHP, Now call like this URL and you get original result with reference key.
Then parse it like:
$data = cURL($reqUri);
$data = json_decode($data);
echo $data ->results[0]->reference;
Hope it will help you
***Note: location=38.908310,-104.784035 this var is not auto you must have it.
For fetching a google review you need reference id for the place.In order to get this reference key you can use google places search api request.
https://maps.googleapis.com/maps/api/place/textsearch/xml?query=restaurants+in+bangalore&sensor=true&key=AddYourOwnKeyHere
Its response will have reference id which you can use in your request.
<PlaceSearchResponse>
<status>OK</status>
<result>
<name>Koshy's Restaurant</name>
<type>bar</type>
<type>restaurant</type>
<type>food</type>
<type>establishment</type>
<formatted_address>
39, St Marks Road,Shivajinagar,Bangalore, Karnataka, 560001, India
</formatted_address>
<geometry>
<rating>3.7</rating>
<icon>
http://maps.gstatic.com/mapfiles/place_api/icons/bar-71.png
</icon>
**<reference>**
CnRwAAAA1z8aCeII_F2wIVcCnDVPQHQi5zdd-3FsDl6Xhb_16OGrILvvvI4X4M8bFk2U8YvuDCKcFBn_a2rjvYDtvUZJrHykDAntE48L5UX9hUy71Z4n80cO7ve_JXww6zUkoisfFnu6jEHcnKeeTUE42PCA4BIQGhGz0VrXWbADarhKwCQnKhoUOR-Xa9R6Skl0TZmOI4seqt8rO8I
**</reference>**
<id>2730db556ca6707ef517e5c165adda05d2395b90</id>
<opening_hours>
<open_now>true</open_now>
</opening_hours>
<html_attribution>
<a href="https://plus.google.com/116912222767108657277">Ujaval Gandhi</a>
</html_attribution>
</photo>
</result>