Getting XML response data with PHP

There are many ways to extract data from XML. Some uses jQuery, JSON and Ajax. I found myself in simpler way, using PHP. I have here a demo XML response from one of the API’s which is Cake Affiliate marketing. You can find the url inside the code (which contains the XML response of that API).

In order to achieve that, what I will be using is a PHP function called simplexml_load_file(), which interprets an XML into an object. Which then you can manipulate it whatever you want.

The code below will display all data from the XML.

George Dan Gil

Programmer, Database Designer and Administrator for Web Applications. Who loves to read and write interesting topics.You can email me at neverender24@gmail.com