Here is an alternate approach: A pre-requisite is to install PI OLEDB Provider.
Then go to http://adodb.org/dokuwiki/doku.php and install the ADODB library for php as directed. There is some introductory information about the library there as well.
My next step was to generate a UDL (save a blank text file with the extension of '.udl'), then double click it to open the Data Link Properties dialog box. Under the Provider tab choose "PI OLE DB Provider". Under the Connection tab type in the name of your pi server in the Data Source text box. You will need to configure log on information unique for your server there as well. For this development connection I used "piarchive" as my 'initial catalog to use'. After your [Test Connection] is successful you can click [OK].
Then right click on your UDL and open with notepad or any text editor. Select and copy the connection string (i.e. "Provider=PIOLEDB.1;. . . etc.).
Next is a bit of code I have used to generate a small table of values for the CDT158 tag, and a corresponding array. In my development version I placed this code between the body tags.
<?php include("adodb/adodb.inc.php"); $connection = new COM("ADODB.Connection") or die("Cannot start ADO"); // PI OLEDB (UDL) connection string. $connection->Open("Provider=PIOLEDB.1;Initial Catalog=piarchive; Data Source=yourPIServerNameHere;Persist Security Info=False"); $result_set = $connection->Execute(" SELECT tag, TIME, value FROM picomp WHERE TIME >= '*-90m' AND tag = 'cdt158' "); $result_count = 0; $labels = array(); while (!$result_set->EOF) { print $result_set->fields[0].' | '.$result_set->fields[1].' | '.$result_set->fields[2].'<br />'; array_push($labels, "{$result_set->fields[1]}"); $result_count = $result_count +1; $result_set->MoveNext(); } echo "<br />The number of records retrieved is: ".$result_count."<br /><br />"; echo "<pre>"; print_r($labels); // this displays the array generated. echo "</pre>"; $result_set->Close(); // optional $connection->Close(); // optional ?>