Showing posts with label soap. Show all posts
Showing posts with label soap. Show all posts

Wednesday, 22 January 2020

How to Read XML using PHP

Let us start with a simple example, for that we need one simple XML file which might be returned in the response of any SOAP or REST.

1. create an XML file, let say we have this file with the name person.xml

<?xml version="1.0" encoding="utf-8"?>
<persons>
        <person id = "101">
            <name>Abdul Qadeer</name>
            <position>CEO</position>
        </person>
        <person id = "102">
            <name>Umar Adil</name>
            <position>CTO</position>
        </person>
</persons>

2. let's create another index.php file to read person.XML file