/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to docs/samples/items.php

  • Committer: Suren A. Chilingaryan
  • Date: 2014-10-17 14:09:35 UTC
  • Revision ID: csa@suren.me-20141017140935-aous739tn3noirae
Added samples of PHP API to documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
require("../adei.php");
 
3
 
 
4
header("Content-type: text/xml");
 
5
header("Cache-Control: no-cache, must-revalidate");
 
6
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 
7
 
 
8
$_GET['db_server'] = "virtual";
 
9
$_GET['db_name'] = "autogen";
 
10
$_GET['db_group'] = "-1";
 
11
 
 
12
try {
 
13
    $req = new GROUPRequest($_GET);
 
14
    $reader = $req->CreateReader();
 
15
    $list = $reader->GetItemList();
 
16
    unset($reader);
 
17
} catch (ADEIException $ex) {
 
18
    $error = xml_escape($ex->getMessage());
 
19
}
 
20
 
 
21
 
 
22
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 
23
if ($error) echo "<result><Error>$error</Error></result>";
 
24
else {
 
25
    echo "<result>";
 
26
    foreach ($list as $value => $info) {
 
27
        $extra = "";
 
28
        if ($info['uid']) $extra .= " uid=\"{$info['uid']}\"";
 
29
 
 
30
        $name = xml_escape($info['name']);
 
31
        echo "<Value name=\"" . $name . "\"$extra value=\"" . $value . "\"/>";
 
32
    }
 
33
    echo "</result>";
 
34
}
 
35
 
 
36
?>
 
 
b'\\ No newline at end of file'