Parcourir la source

secret api call

master
memespring il y a 16 ans
Parent
révision
cdecddd8bd
2 fichiers modifiés avec 18 ajouts et 1 suppressions
  1. +6
    -1
      docs/api.php
  2. +12
    -0
      docs/include/application.php

+ 6
- 1
docs/api.php Voir le fichier

@@ -118,7 +118,12 @@ class api {
$this->applications = Applications::query_area($_GET['bottom_left_easting'], $_GET['bottom_left_northing'], $_GET['top_right_easting'], $_GET['top_right_easting']); $this->applications = Applications::query_area($_GET['bottom_left_easting'], $_GET['bottom_left_northing'], $_GET['top_right_easting'], $_GET['top_right_easting']);
} }
break; break;

case "latest":
$this->applications = Applications::query_latest(500);
break;

query_latest
default: default:
$this->warnings = "No call type specified"; $this->warnings = "No call type specified";
} }


+ 12
- 0
docs/include/application.php Voir le fichier

@@ -145,6 +145,18 @@ class Applications{
return applications::load_applications($application_results); return applications::load_applications($application_results);
} }
//latest
function query_latest($count = 100) {
$db = DB::connect(DB_CONNECTION_STRING);
$sql = "select council_reference, address, postcode, description, info_url, comment_url, map_url, x, y, date_recieved, date_scraped, full_name
from application
inner join authority on application.authority_id = authority.authority_id
order by date_scraped desc limit " . $count;

$application_results = $db->getAll($sql);
return applications::load_applications($application_results);
}
function load_applications($application_results){ function load_applications($application_results){
$applications = array(); $applications = array();
if (sizeof($application_results) > 0) { if (sizeof($application_results) > 0) {


Chargement…
Annuler
Enregistrer