Fri Jan 30, 2015 12:35 pm
//includes the IP2Location framework
require_once('IP2Location.php');
//function that sends and retrieves an answer from a HTTP request
function SendRequest( $url, $method = 'GET', $data = array(), $headers = array('Content-type: application/x-www-form-urlencoded') )
{
$context = stream_context_create(array
(
'http' => array(
'method' => $method,
'header' => $headers,
'content' => http_build_query( $data )
)
));
return file_get_contents($url, false, $context);
}
//the client's IP
$ip = $_SERVER['REMOTE_ADDR'];
// Standard lookup with no cache
$loc = new IP2Location('databases/db24.bin');
$stationCode=FindIPWeatherStationCode($ip,$loc);
GetWeatherForecastFromYahoo($stationCode);
Mon Apr 13, 2015 8:46 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.