![]() |
xml feed into php/MYSQL listings site - noob question(s)
Hello all
i have a listings site that runs php from mysql results, all good but now I want to take an xml feed from a client with hundreds of live listings all new to me and i want to be sure I have the big picture right before plunging in am I right to think that I give them an XML template which is really just a list of the fields I need and the tags for each, so more or less what I'd get from my current MYSQL query, data and markup wise? So when my regular MYSQL query runs, I also pull the xml data from their site (or from a cache of that feed), parse it and then merge it with the array from MYSQL, on the fly server side, and then carry on as before? Is it that simple and are there any noob dos and don'ts? thanks Tynan |
I'd advise you to use JSON -newer data format which is much easier to use.
But if you still want to use XML, PHP has a very robust XML parser. It has many methods that will make XML parsing a breeze. Check out phpfreaks' xml tutorial. http://www.phpfreaks.com/tutorial/handling-xml-data |
Hi and thanks
noted but client is asking to use XML so I guess I'm stuck with what he wants to feed Are my airey and vague assumptions correct and workable though? |
Yeah. That's doable. Done that a lot before.
Although your job is also to advise your client. Make him see the light on JSON. Unless he has a very specific reason to use XML like that is what their feeds are made using. |
Thanks, have skimmed that tutorial on the link and it looks a doddle which is nice
I'll get this one under my belt before telling people doing it already what to do I think Thanks for your help, I may of course be back in due course :) |
And here indeed I am again
I've quite happily managed to parse XML feeds and access the data and loop through it etc etc But I'm now trying to build a php array from the xml that I can then merge with an existing array from a local MYSQL query When my doubtless simpleton code as below runs PHP Code:
The xml file is as below in case it's not normal http://www.xml2u.com/Xml/Blue%20Squa...89_Default.xml yesterday I could create an array, today only a error Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "" in /home/rauxvsuj/public_html/ClassifiedXML.php on line 175 sorry, I'm frazzled and confused and would love someone to squint at the xml feed and point in the right direction to create a nice and easy php array, from there I can do it |
bah, I think I'm there after posting it here, ain't that so often the way, the below copied from somewhere gives me a clean array
PHP Code:
|
so far so good, I can load everything into the php array except a list of images that are numbered and use the tag name 'image' nested inside another tag name of 'image', I can't get into there, I presume because the DOM code finds the outer image tag? Google not helping specifically so far
Code:
<images> |
Quote:
PHP Code:
Code:
<images>PHP Code:
|
found a way around this, apologies for anyone reading my rather frenetic and unclear posts above
|
| All times are GMT +1. The time now is 06:12 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.