Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Calculate Geohash, rather than get it from the web service

  • Loading branch information...
commit 5ccdf5cbc4140c0dc2725de9cd5e5b3ff3074fe4 1 parent aebcbbe
@pezholio authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 postcode.php
View
9 postcode.php
@@ -3,6 +3,7 @@
require_once("xmlparse.php");
require_once("phpcoord-2.3.php");
require_once("json.php");
+require_once("geohash.php");
//require_once("electoraldistrict.php");
$link = mysql_connect($db_host, $db_username, $db_password);
@@ -78,12 +79,8 @@
$easting = $row['easting'];
$northing = $row['northing'];
-$ch_geohash = curl_init("http://geohash.org?q=".$lat.",".$lng."&format=url");
-curl_setopt($ch_geohash, CURLOPT_TIMEOUT, 5);
-curl_setopt($ch_geohash, CURLOPT_RETURNTRANSFER, 1);
-curl_setopt($ch_geohash, CURLOPT_FOLLOWLOCATION, true);
-$geohash = curl_exec($ch_geohash);
-//$geohash = file_get_contents("http://geohash.org?q=".$lat.",".$lng."&format=url");
+$hash = $geohash->encode($lat, $lng);
+$geohash = "http://geohash.org/" + $hash
$mapit = null;
if (!strstr($row['countygss'], "99999999")) {
Please sign in to comment.
Something went wrong with that request. Please try again.