PHP code example of mills / google-places

1. Go to this page and download the library: Download mills/google-places library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mills / google-places example snippets



Key       = 'Your Google Places API Key';
$googlePlaces = new googlePlaces($apiKey);

// Set the longitude and the latitude of the location you want to search near for places
$latitude   = '-33.8804166';
$longitude = '151.2107662';
$googlePlaces->setLocation($latitude . ',' . $longitude);

$googlePlaces->setRadius(5000);
$results = $googlePlaces->search(); //

$firstSearch = $googlePlaces->Search();

if (!empty($firstSearch['next_page_token'])) {
	$secondSearch = $googlePlaces->repeat($firstSearch['next_page_token']);
}

$proxy = [];
$proxy["host"] = "your host name";
$proxy["port"] = 8080;
$proxy["username"] = "your username"; //optional with password
$proxy["password"] = "your password";
$apiKey       = 'Your Google Places API Key';
$googlePlaces = new googlePlaces($apiKey, $proxy);