Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't call mapit again if you've already just done it.

  • Loading branch information...
commit 53fae9db27a8b2840b201d7b296b033772698b3d 1 parent 9a3c9a2
Matthew Somerville dracos authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 postcode.php
5 postcode.php
View
@@ -79,6 +79,7 @@
$geohash = file_get_contents("http://geohash.org?q=".$lat.",".$lng."&format=url");
+$mapit = null;
if (!strstr($row['countygss'], "99999999")) {
$countytitle = $row['countyname'];
@@ -126,7 +127,9 @@
if (strlen($row['parish'] == 0)) {
- $mapit = json_decode(file_get_contents("http://mapit.mysociety.org/postcode/". urlencode($updatepostcode) .".json"));
+ if (!$mapit) {
+ $mapit = json_decode(file_get_contents("http://mapit.mysociety.org/postcode/". urlencode($updatepostcode) .".json"));
+ }
foreach ($mapit->areas as $area) {
if ($area->type_name == "Civil Parish") {
Please sign in to comment.
Something went wrong with that request. Please try again.