XML Feed

4 posts by 3 authors in: Forums > CMS Builder
Last Post: November 25, 2015   (RSS)

Is there a way to generate an XML feed from my website to another company's website?

Thanks in advance.

Hi Daryl

Thanks for this - but how does it work if you've got multiple pages (eg. .php?1, php?2, php?3) with each page containing specific data (drawn from the database) to generate the feed?  At the moment, if it's only a specific page, there would be over 90 pages.

Thanks

Carole

By ross - November 25, 2015

Hi Carole

With your current example, the other site would need to know the individual URL's and have a command to load each one of them individually.  If your pages are numbered sequentially, though, the other site could use a "for" loop like this:

for ($i = 1; $i <= 10; $i++) {
    $yourWebsitesXmlPageContents = file_get_contents("http://yourwebsite.com/xml.php?$i");
    echo $yourWebsitesXmlPageContents;
}

Does that seem like it could work?

Another option would be to provide the other site with a single feed and after they use code like Daryl's to get the contents, they can parse it out themselves.

Ross

for ($i = 1; $i <= 10; $i++) {
    echo $i;
}

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/