Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-04-2007, 03:00 PM #1
- Join Date
- Jan 2007
- Thanked 0 Times in 0 Posts
extracting xml data to put in mysql table
Hi all. Just when I think I've learnt enough to cope another comes something else. I'm just a designer but everyone seems to think I can develop. Which is ok. Mostly. This though is causing me to go a bit doolally.
I've got an xml file that contains amongst others the element <currency> which contains these childs. <cname><csymbol><crate>. There are nearly 200 <currency>. I need to use XPath (although I've no idea how ) to extract those values so that I can insert the whole lot into a mysql db. I will then call the relevant data back to my webpages when required.
The xml file will be purchased as a licensed file so I can't touch it in any way or move it so I need to refer to it where it is. I'll need to run cron job or windows scheduler to run my script on a daily basis.
Any help would be great as I'm currently having to manually update my fields.
Oh and my web server is only running php4.*
01-04-2007, 05:53 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
This can be done with php version 4.x using the libxml-2.4.14 library. I'm in class right now, so I will post later an example of how to do this, but you can feel free to take a look at the DOM XML functions in the meantime.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');