Permalink
Browse files

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

  • Loading branch information...
1 parent 9a3c9a2 commit 53fae9db27a8b2840b201d7b296b033772698b3d @dracos dracos committed Jun 21, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 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") {

0 comments on commit 53fae9d

Please sign in to comment.