Skip to content

Instantly share code, notes, and snippets.

@winofi
Last active January 20, 2019 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save winofi/6e4fc1fc2aa29451cfeab3e67b8abc7c to your computer and use it in GitHub Desktop.
Save winofi/6e4fc1fc2aa29451cfeab3e67b8abc7c to your computer and use it in GitHub Desktop.
suggested wspr polling interface
<?php
//get start parameter (intval returns 0 for bad integer values)
$start = intval($_GET["minid"]);
//create database connection (assuming some sort of mysql is uses)
$db = new mysqli("localhost", "root", "root", "wspr");
//query the data, limit might be modified
$res = $db->query("SELECT * FROM `spots` WHERE `spot_id` > ".$start." LIMIT 0, 1000;");
//check database result
if (!$res) {
echo "database error\n";
exit;
}
//dump the data as csv
while ($row = $res->fetch_row()) {
echo implode(",", $row)."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment