//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);
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.