In the XML data that we retrieved, which contains the list of clients, we will find all the XLinks providing access to customer information.
<customers> <customer id="1" xlink:href="http://myprestashopexample.com/api/customers/1" /> </customers>
The XLink for the
customer tag with ID 1 is:
This link retrieves a new XML file, which contains information about the client who has ID 1.
In order to manage access to different clients, we will associate page identifiers with customers via a
GET parameter named "id". The link
we will display the file for customer 1.
Currently, we are using the
clients resources. If we'd been trying to change the
countries resources, this ID would have been a country ID.
$opt['resource'] = 'customers'; $opt['id'] = $_GET['id']; $xml = $webService->get($opt);
Accessing resources is performed as above for displaying the list, because the tags that interest us are children of the
$resources = $xml->customers->children();
This path can be created in another way (here in an HTML table):
foreach ($resources as $key => $resource) echo 'Name of field: ' . $key . ' - Value: ' . $resource . '<br />';