+ function createHeader($data) {
+ $out = '';
+ foreach ($data as $head => $value) {
+ $out .= "<th>$head</th>";
+ }
+
+ return $out;
+ }
+
+ function parseResponse($raw) {
+ if (count($raw) < 1) {
+ return '';
+ }
+ $headers = createHeader($raw[0]);
+ $r = "<table><tr>$headers</tr>";
+ foreach ($raw as $obj) {
+ $r .= '<tr>';
+ foreach ($obj as $value) {
+ $r .= "<td>$value</td>";
+ }
+ $r .= '</tr>';
+ }
+ $r .= '</table>';
+
+ return $r;
+ }
+