Пример #1
0
 public function getLocationFromIp()
 {
     $ip = $this->getIpAdress();
     if (empty($ip)) {
         throw new Exception('Error retrieving IP address');
     }
     // Use the method your server supports ( most of them only support curl )
     $xmlData = geoLocateIp::file_get_contents_curl($this->serviceLocateURL . $ip);
     //$xmlData = file_get_contents($this->serviceLocateURL.$ip);
     if (empty($xmlData)) {
         throw new Exception('Error retrieving xml');
     }
     $locationInfo = $this->parseLocationData($xmlData);
     return $locationInfo;
 }
Пример #2
0
<?php

session_start();
include "db.php";
include 'geoLocateIp.class.php';
$geo = new geoLocateIp();
$location = $geo->getLocationFromIp();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Que Comes! - food social network</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 00px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #981c12
	;
}
-->
</style>
<link href="css/general.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	left:45px;