PHP XML and PHP Backends Sharing Data Tutorial

What if you could script remote procedure calls between web sites as easily as you can do among programs? This tutorial will explain how it can be done in PHP.

PHP XML and PHP Backends Sharing Data Tutorial

PHP XML and PHP Backends Sharing Data Tutorial

     

PHP XML and PHP Backends Sharing Data Tutorial

What if you could script remote procedure calls between web sites as easily as you can do among programs? This tutorial will explain how it can be done in PHP.

XML and PHP Backends Sharing Data

Scripting languages have been in use for years to make function calls and to integrate disparate applications. A little bit of script glue can make applications from different vendors talk to each other and exchange information.
Ever wished you could do that for web sites? Well, now you can. XML-RPC is a very simple protocol for performing remote procedure calls over HTTP. It was designed by Userland Software , working with Microsoft .

First of all we need to create an xml file and save it in the same directory where you will develop your php file. As you might know that an xml file is easy to create, it supports user-defined tags. So just copy and paste the following xml code or you may write your own:

MyFirst.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<lang>
<php>
PHP is very easy to learn
</php>
<Java>
Java is the king of open source language
</Java>
</lang>

phpXml.php

<?php

$cont=simplexml_load_file("MyFirst.xml");

echo $cont->getName().'<br/>';

foreach($cont->children() as $child)

{

echo $child->getName().':'.$child.'<br/>';

}

?>

Output:

lang
php: PHP is very easy to learn
Java: Java is the king of open source language