XML file create with PHP containing Dynamic data | Web Programming Tutorial

XML file create with PHP containing Dynamic data

Published Date: October 21, 2013 |
Published Time: 12:33 am |

In last topic, simply i have discussed how to write and read xml file . Tody we will see how can we make xml file with php with dynamic data with help of PHP DOM (document object model) library.

The data of the site may change continuously.so we can’t use fixed xml file.because it is not possible to change xml file continuously when data is changed or added.So we need a automatic way where xml file will be changed automatically. So for this we will use php code to generate xml file.

Create XML FILE:

create a php file named like create_xml.php,Write this code. Execute it, it will create a xml file nameddatabase.xml.

we can use database.xml file for grabbing data. But it will not be wise. Because we need updates data, so we will directly use PHP file  for grab not xml.

So grabbing is same what i before write at the last topics.Change is we will load the php file instead of xml file. Ok let’s see…..

Output :

konok is 26
Kajol is 25

Data from database: So now you can understand how we make xml file with data taken from database. Simply connect to database, fetch data and make xml file like above code.

Thanks,next i will discuss about RSS Feed.


  1. seo says:

    Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *