<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");

include ("config.php");

$origin     = stripslashes(htmlspecialchars(strip_tags($_GET['query'])));
$origin     = mysqli_real_escape_string($con,$origin);

$origin = $origin.',Nigeria';
$origin = str_replace(' ', '%20', $origin);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$origin&region=ng&key=AIzaSyCVpBowbdZqwo-eMCbY_lVhhuQj5aUn3Tk");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);

 echo $response = curl_exec($ch);
curl_close($ch);

 
   ?>