Exemplo n.º 1
0
 public function testWhereQuery()
 {
     $soql = new SoqlQuery();
     $soql->where("state = 'AR'");
     $results = $this->dataset->getDataset($soql);
     foreach ($results as $result) {
         $this->assertEquals($result['state'], 'AR');
     }
 }
Exemplo n.º 2
0
// You may also use "include_once," "require," or "require_once"
include "phpsoda-0.1.0.phar";
// PhpSoda organizes its code inside namespaces; in order to use PhpSoda, you'll have to "use" the namespaces. These
// three namespaces should suffice for most code.
use allejo\Socrata\SodaClient;
use allejo\Socrata\SodaDataset;
use allejo\Socrata\SoqlQuery;
// If someone has pushed the "Submit" button, this'll be set to true
$postBack = $_SERVER['REQUEST_METHOD'] == 'POST';
if ($postBack) {
    // Our client will store information about the host, token, and authentication (if necessary)
    $sc = new SodaClient("data.seattle.gov", "B0ixMbJj4LuQVfYnz95Hfp3Ni");
    $ds = new SodaDataset($sc, "pu5n-trf4");
    // Build a SoqlQuery with functions
    $soql = new SoqlQuery();
    $soql->where("within_circle(incident_location, {$_POST['latitude']}, {$_POST['longitude']}, {$_POST['range']})")->limit(20);
    // Get the dataset. $results is now an associative array in the same format as the JSON object
    $results = $ds->getDataset($soql);
}
?>

<html>
    <head>
        <title>Seattle Police Department 911 Incident Response</title>
    </head>
    <body>
        <h1>Seattle Police Department 911 Incident Response</h1>

        <?php 
if (!$postBack) {
    ?>