Nearby Restaurants

Every one like to have food from good eating places, restaurants and hotels. Sometime you are in the city but you don’t know where to go or if you know where to go you doubt will that reataurant/ food joint/ eating place is open now!

So guys here listoftop.net presents a simple locaton based listing which can be accessed globaly giving you list of top reataurants/ food joints/ eating places near you. (sorted first by distance from you then by relavency).

[insert_php]
if (getenv(‘HTTP_CLIENT_IP’))
$ipaddress = getenv(‘HTTP_CLIENT_IP’);
else if(getenv(‘HTTP_X_FORWARDED_FOR’))
$ipaddress = getenv(‘HTTP_X_FORWARDED_FOR’);
else if(getenv(‘HTTP_X_FORWARDED’))
$ipaddress = getenv(‘HTTP_X_FORWARDED’);
else if(getenv(‘HTTP_FORWARDED_FOR’))
$ipaddress = getenv(‘HTTP_FORWARDED_FOR’);
else if(getenv(‘HTTP_FORWARDED’))
$ipaddress = getenv(‘HTTP_FORWARDED’);
else if(getenv(‘REMOTE_ADDR’))
$ipaddress = getenv(‘REMOTE_ADDR’);
else
$ipaddress = ‘UNKNOWN’;

$query = unserialize(file_get_contents(‘http://ip-api.com/php/’.$ipaddress));
if($query && $query[‘status’] == ‘success’) {

$country = $query[‘country’];
$city = $query[‘city’];
$lat = $query[‘lat’];
$long = $query[‘lon’];
$regionName = $query[‘regionName’];
$zip = $query[‘zip’];

} else {
$geoplugin = unserialize( file_get_contents(‘http://www.geoplugin.net/php.gp?ip=’ . $ipaddress) );

if ( is_numeric($geoplugin[‘geoplugin_latitude’]) && is_numeric($geoplugin[‘geoplugin_longitude’]) )
{ $lat = $geoplugin[‘geoplugin_latitude’];
$long = $geoplugin[‘geoplugin_longitude’];
$city = $geoplugin[‘geoplugin_city’];
$country = $geoplugin[‘geoplugin_countryName’];
$region = $geoplugin[‘geoplugin_regionName’];
}
}

//echo “$lat; $long; $city; $country”;
if ($zip ==””)
{$zip=$city;}

echo “List Of Top Restaurants In $regionName ($zip)

“;

$jsonurl = “https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$lat,$long&type=restaurant&radius=1000&opennow=1&key=AIzaSyAMPZpDhHouh7Ai2MgYZY1_JIWfKhmRMcw”;
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
echo ”

      “;

 

      foreach ( $json_output->results as $trend )

 

      {

 

      echo ”

    1. Name : {$trend->name}\n

“;
echo “Type : “;
foreach ( $trend->types as $tt )
{
if ($tt==”point_of_interest”){ echo “Place of interest, “;}
else echo “$tt, “;
}
echo ”
“;
$pid = $trend->place_id;
//echo $pid;
$jsonp = “https://maps.googleapis.com/maps/api/place/details/json?placeid=$pid&key=AIzaSyAMPZpDhHouh7Ai2MgYZY1_JIWfKhmRMcw”;
$jsonpl = file_get_contents($jsonp,0,null,null);
$json_pid = json_decode($jsonpl);
$ttl = $json_pid->result;
echo “Address : {$ttl->formatted_address}
“;
$ph = $ttl->international_phone_number;
if ($ph == “”)
{echo “Phone : Not Available
“; }
else {echo “Phone : $ph
“;}

$star = $ttl->price_level;
if ($star == “”)
{echo “Stars : N/A, “; }
else {echo “Stars : $star, “;}

$rate = $ttl->rating;
if ($rate == “”)
{echo “Users Rating : N/A,
“; }
else {echo “Users Rating : $rate
“;}

$link_address = $ttl->url;
if ($trend->opening_hours->open_now == “1”)
{echo “Open Now : Yes
“;}
else
{echo “Open Now : Closed
“;}

echo ‘Locate On Map‘;

$source = $trend->scope;
echo ”
“;
}
echo ”

“;

echo “Powered By : $source”;
echo ”
“;
echo ‘SOURCE : Team listoftop.net, India’;

[/insert_php]

Location is derived from visitor IP, so listing may not be accurate if using proxies. For better experience reload this page without proxy.

Leave a Reply

Your email address will not be published. Required fields are marked *