Reading XML responses

The Lipperhey API always gives a response in XML. After you did an API call by requesting an url (get) you will recieven a response in XML. Every modern programming language can parse XML files.

Reading XML with PHP (version 5 and higher)

//Retrieve XML response of API
= file_get_contents("http://api.lipperhey.com/1.0/?apikey=[your-api-key]&method=result&id=1653176");
= simplexml_load_string();

//Read values from XML response
= (string)->website->error;
= (string)->website->queued;
= (string)->website->finished;

Reading XML with JavaScript

//Retrieve XML response of API
xmlDoc = new window.XMLHttpRequest();
xmlDoc.open("GET", requesturl, false);
xmlDoc.send("");
xmlDoc = xmlDoc.responseXML;

//Read values from XML response
var datum = xmlDoc.getElementsByTagName("website")[0].getAttribute("timestamp");
var technical = xmlDoc.getElementsByTagName("technical")[0].childNodes[0].nodeValue;