Google-api-php-client: Google places API support

Created on 16 Feb 2016  路  1Comment  路  Source: googleapis/google-api-php-client

Couldn't find a service class for google places API. Is it possible right now to fetch place lat, long, name, country, address details by place_id or place name?

Also I have a question not related to this repo. Why Google allows searching for places by name without APP KEY and requires APP KEY when searching by place_id?

Most helpful comment

@Mevrael The Places API is not currently exposed in the Discovery Service, which is what this library uses to generate the service classes.

For this reason, I suggest making the calls using the HTTP client, which you can do using the authorize method:

$client = new Google_Client();
// set your API Key
$client->setDeveloperKey($myKey);

// get the authorized HTTP Client object
$http = $client->authorize();

// make the call!
$url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json'
  . '?location=-33.8670522,151.1957362'
  . '&radius=500'
  . '&types=food'
  . '&name=harbour'

$result = $http->get($url);

>All comments

@Mevrael The Places API is not currently exposed in the Discovery Service, which is what this library uses to generate the service classes.

For this reason, I suggest making the calls using the HTTP client, which you can do using the authorize method:

$client = new Google_Client();
// set your API Key
$client->setDeveloperKey($myKey);

// get the authorized HTTP Client object
$http = $client->authorize();

// make the call!
$url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json'
  . '?location=-33.8670522,151.1957362'
  . '&radius=500'
  . '&types=food'
  . '&name=harbour'

$result = $http->get($url);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mevsme picture mevsme  路  4Comments

Fredyy90 picture Fredyy90  路  3Comments

camohub picture camohub  路  3Comments

ghost picture ghost  路  4Comments

Romain picture Romain  路  4Comments