API to get all the reviews and rating from Google for business

前端 未结 3 2059
情书的邮戳
情书的邮戳 2021-02-07 06:18

I am using the Google Maps API to get the reviews and ratings for a company.

Step 1: HTTP Request to get the reference Id.

$url = \'https://maps.googleap         


        
相关标签:
3条回答
  • 2021-02-07 06:49

    Currently, Google provides up to five results only, they mentioned it in their documentation. If you want to get reviews for your own property/place or business you can go for my business but I think they made that API closed one.

    Edit: If you still want to fetch all reviews you can use an HTML parser and parse all the reviews(i don't know about Google's data policy, but you can definitely scrape everything from a site)

    0 讨论(0)
  • 2021-02-07 06:57

    You should need to use the Google My Business API if you want to get all the reviews.

    It's another different API, and you should request from Google the property of the place.

    https://developers.google.com/my-business/content/review-data#list_all_reviews

    0 讨论(0)
  • 2021-02-07 06:57

    Other simple method to get the 5 last rewiews with the place_id of the location (you can find it here : https://developers.google.com/places/place-id)

    $url = "https://maps.googleapis.com/maps/api/place/details/json?key=Yourkey&placeid=YourplaceID";
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec ($ch);
    $res        = json_decode($result,true);
    $reviews    = $res['result']['reviews'];
    
    0 讨论(0)
提交回复
热议问题