<!DOCTYPE HTML> <html> <header> <title>Google Place Test</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </header> <body> <h1>Google Place Test</h1> <?php require_once 'googlePlaces.php'; $searchArea = $_GET['location']; echo '<p>Restaurant near ' . $searchArea . '</p>'; $apiKey = 'AIzaSyDbZH9Gk817QYnpNcq21n8w2PaDPu0QhOQ'; $googlePlaces = new googlePlaces($apiKey); $googlePlaces->setRadius(2000); $keyword = 'restaurants in ' . $searchArea; $googlePlaces->setQuery($keyword); $results = $googlePlaces->textSearch(); foreach ($results['result'] as $information) { echo $information['name']; echo '<br/>'; if (!empty($information['photos'])) { foreach ($information['photos'] as $p) { if (!empty($p['photo_reference'])) { $URL = $googlePlaces->photo($p['photo_reference'], $p['height'], $p['width']); $s1 = '<img src="'; $s2 = '">'; echo $s1 . $URL . $s2; //echo $p['photo_reference']; echo '<br/><br/>'; }
<!DOCTYPE HTML> <html> <header> <title>Google Place Test</title> </header> <body> <h1>Google Place Test</h1> <?php require_once 'googlePlaces.php'; $apiKey = 'AIzaSyDbZH9Gk817QYnpNcq21n8w2PaDPu0QhOQ'; $googlePlaces = new googlePlaces($apiKey); // Set the longitude and the latitude of the location you want to search near for places $latitude = $_GET['latitude']; $longitude = $_GET['longitude']; if (empty($latitude) || empty($longitude)) { $latitude = '-33.8804166'; $longitude = '151.2107662'; } $googlePlaces->setTypes('food'); $googlePlaces->setLocation($latitude . ',' . $longitude); $googlePlaces->setRadius(2000); $results = $googlePlaces->Search(); foreach ($results['result'] as $information) { echo $information['name']; echo '<br/>'; if (!empty($information['photos'])) { foreach ($information['photos'] as $p) { if (!empty($p['photo_reference'])) { $URL = $googlePlaces->photo($p['photo_reference'], $p['height'], $p['width']); $s1 = '<img src="'; $s2 = '">';