API - PHP Example Application

Documentation Home

Requirements

In order to run this example, you will need:

Files

Download ExamplePHP.zip. This example contains the following files:

  • ExamplePHP.php
  • readme.txt

Running the Example

To run the example, place the file on your PHP enabled server. The URL to request is hardcoded in the source as the $URL variable. If you encounter any class not found errors, verify that you have the cURL and DOM libraries installed.

The Source Code

This example uses PHP's cURL and DOM libraries to request and parse the XML.

requestXml($url)

This function uses cURL to request the XML. The resulting XML is returned as a String.

DOMDocument::loadXML($xml)

This function takes the XML String and parses it into a DOMDocument.

outputXml($xmlDoc)

This function uses the DOMDocument to access the XML as a DOM tree. Nodes of the tree are retrieved by name and looped through to output the form result's information.

Documentation Home