Including a live EQL Data table or query from a PHP script

Question

I'm writing a web application in PHP. I want some data from EQL to be included on one of my PHP pages. How do I do it?

Answer

The easiest way to include the data is by reading the verbatim table data into your PHP output, like this:

<?php
    readfile("http://eqldata.com/db/test1db/MyTest/Table/Junk.ehtml");
?>

You can also have the client's web browser read the data via JavaScript. We discuss this in detail in Publishing live tables and queries. This requires your client's browser to have JavaScript enabled, but it puts less load on your server since the user can read the data directly from EQL.

Finally, if you want to post-process the query results from PHP, you can read the data structure in JSON format, using code like the following:

<?php
    $f = fopen("http://eqldata.com/db/test1db/MyTest/Table/Junk.json", "r");
    $data = json_decode(fread($f, 1000000));
    print "<pre>";
    var_dump($data);
    print "</pre>"; 
?>

The above script will set $data to contain the list of column and row objects in the table.

Related Articles

Unrelated Articles