rgb192
asked on
create an xml file using php
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
</url>
<url>
<loc>http://www.example.com/catalog?item=12&desc=vacation_hawaii</loc>
<lastmod>2004-12-23</lastmod>
</url>
<url>
<loc>http://www.example.com/catalog?item=73&desc=vacation_new_zealand</loc>
<lastmod>2004-12-23</lastmod>
</url>
<url>
<loc>http://www.example.com/catalog?item=74&desc=vacation_newfoundland</loc>
<lastmod>2004-12-23T18:00:15+00:00</lastmod>
</url>
<url>
<loc>http://www.example.com/catalog?item=83&desc=vacation_usa</loc>
<lastmod>2004-11-23</lastmod>
</url>
</urlset>
input is a an array of urls
http://www.example.com/
http://www.example.com/catalog?item=12&desc=vacation_hawaii
http://www.example.com/catalog?item=73&desc=vacation_new_zealand
http://www.example.com/catalog?item=74&desc=vacation_newfoundland
http://www.example.com/catalog?item=83&desc=vacation_usa
output is xml file
lastmod node can be current time
What is the question? XML files are strings of data. PHP string variables can have variable substitution.
ASKER
I want the xml file in the code block to be the output
created by php
with the php input an array of urls
http://www.example.com/
http://www.example.com/catalog?item=12&desc=vacation_hawaii
http://www.example.com/catalog?item=73&desc=vacation_new_zealand
http://www.example.com/catalog?item=74&desc=vacation_newfoundland
http://www.example.com/catalog?item=83&desc=vacation_usa
created by php
with the php input an array of urls
http://www.example.com/
http://www.example.com/catalog?item=12&desc=vacation_hawaii
http://www.example.com/catalog?item=73&desc=vacation_new_zealand
http://www.example.com/catalog?item=74&desc=vacation_newfoundland
http://www.example.com/catalog?item=83&desc=vacation_usa
OK, from an array to XML is easy enough. Where would we get the information shown in the <lastmod> tag? Once we have that, I can show you how to build this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
and
date() will always have todays date in the xml file
thanks
and
date() will always have todays date in the xml file
thanks