Help - Search - Members - Calendar
Full Version: Xml, Php, And Mysql Help
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Mr. Majestic
Can someone tell me how to take the data out of an element from a XML files and insert it into a MYSQL table field. Meaning how could I take this data:
CODE
<name>This is my name</name>

and insert it into MYSQL.
Mr. Majestic
Ok, here is the deal. I've figured out the above question, but now I have another one. I have some Gzip files on another server. I would like to have a PHP (or java) file to unzip this file and store the contents in a given directory. Anyone help me do this?
NaRzY
Zymic doesn't yet have the feature to uncompress via the ZHCP. You must do it on your local machine then upload.

Jacob.
Mr. Majestic
QUOTE(NaRzY @ Jul 29 2008, 08:33 AM) *
Zymic doesn't yet have the feature to uncompress via the ZHCP. You must do it on your local machine then upload.

Jacob.

If it makes a difference this site isn't hosted by zymic.
wozzym
http://net2ftp.com smile.gif
Mr. Majestic
I'm going to give it a try, but I don't think it can do what I want. The site that I am working on is rather complicated. It must download and unzip GZip files from a project server, read the contained XML stats directory into MYSQL and then delete the Gzip file. This all needs to happen automatically at a certain time (which will be made simple with cron jobs if I can just get a php or java file to do this!)
Trippin7464
I personally don't know anything about gzip, but after a quick google search i'm pretty sure you need the zlib extension installed on your server (you can do a phpinfo() and check if it is installed and enabled [on my phpinfo i scrolled about 3/4 of the way down and it was there]) and the php manual has a list about it. http://www.php.net/manual/en/ref.zlib.php
Lop12a
Hi Mr. Majestic,
I think you may use the DOM XML object to solve your problem. Please goto this site for more details http://us2.php.net/domxml
Tim
Tbh the best way to extract data from XML files is using SimpleXML, its a function thats normally default in PHP.

to use the class you would use something like
CODE
$xmlArray = SimpleXMLElement("<user><name>My Name</name></user>");

echo $xmlArray->user->name;


this will work with fopen and curl resources too

I hope this helps.
Trippin7464
Well considering fopen and curl are both disabled on this server, I don't know if SimpleXML is installed.
Tim
Hmm as he never mentioned that hes on zymic servers I never assumed so.
Trippin7464
Thats true Tim, I didn't re-read the thread after I posted, He did say "If it makes a difference this site isn't hosted by zymic."
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.