Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

We will now look at how to view a full list of clients' IDs. We could display more information and customize it…but we'll take a look at that later in this tutorial.

To retrieve an XML file containing all the customers we have to use the "get" method whose array is as follows:





Code Block
$opt[ 'resource' ] = 'customers';
$xml = $webService->get( $opt ); 

The value defines the resource that the web service will use in a future call. The value could be carrier types, countries or any other type of resource that can be found in the Web Service tab of the "Back Office".


Calling the method will return us to a SimpleXML object containing all client IDs.

Code Block
      Client ID
...Other client tags

Now we need to access the tags that interest us in the XML file.


By getting the return of $webService->get, we are at the root of the document.

Code Block
$resources = $xml->customers->children();

To access the fields of clients who are children from the Customers tag, we only need to retrieve all fields in an associative array in SimpleXML like this:

From there we can access client IDs easily. Here's an example with a path from identifiers:

Code Block
foreach ( $resources as $resource )
  echo $resource->attributes() . '<br />'; 

Thanks to these elements, you create a HTML table containing all the customers' IDs before going on to the next chapter.
You can use the "customers" tab in the Back Office to find the IDs of all customers. If you encounter difficulties, please look at the file code 0-CustomersList.php for the results you should get.