5 Replies - 703 Views - Last Post: 25 August 2011 - 05:23 AM Rate Topic: -----

#1 momo1984  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 25-August 11

Php , Mysql and XML parsing

Posted 25 August 2011 - 04:00 AM

Hi ,
I hope I can get some advice on a project I am starting. I have basic understanding in PHP/Mysql and XML, but if needed I can look into other languages.

It looks like that :

On my local pc an XML file is generated every period of time and stored.

On another server I have a Mysql Database.

I need a way to parse the XML file automatically as soon as it is generated and store the information from the xml file into the Mysql database on the other server and when this is successfully done, the xml file will be deleted.

Can this be done ? Any hints ? Is it possible to implement using PHP ? or any other language ...

Thanks for your time.

kind Regards,
Mortada

Is This A Good Question/Topic? 0
  • +

Replies To: Php , Mysql and XML parsing

#2 aaron1178  Icon User is offline

  • Dovakiin, Dragonborn
  • member icon

Reputation: 169
  • View blog
  • Posts: 1,297
  • Joined: 22-October 08

Re: Php , Mysql and XML parsing

Posted 25 August 2011 - 04:30 AM

Hello and welcome to Dream.In.Code. Yes this is possible but I myself would not do so. This could cause security issues and sometimes loss of data translation, even though it only happens rarely.

I myself would either use POST and GET encrypted data or use the cURL functions. I have supplied a link to the Php manual on this section.

cURL - Php.net

Also, this would require a lot of server resources to create an XML file X amount of time and then delete it after the file contents have been sent to the remote database

This post has been edited by aaron1178: 25 August 2011 - 04:32 AM

Was This Post Helpful? 1
  • +
  • -

#3 momo1984  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 25-August 11

Re: Php , Mysql and XML parsing

Posted 25 August 2011 - 04:42 AM

View Postaaron1178, on 25 August 2011 - 04:30 AM, said:

Hello and welcome to Dream.In.Code. Yes this is possible but I myself would not do so. This could cause security issues and sometimes loss of data translation, even though it only happens rarely.

I myself would either use POST and GET encrypted data or use the cURL functions. I have supplied a link to the Php manual on this section.

cURL - Php.net

Also, this would require a lot of server resources to create an XML file X amount of time and then delete it after the file contents have been sent to the remote database

Thank you aaron1178 for the help, I will look into the Curl tutorial on php.net.
I was thinking if I had access to the code/function that is generating the XML files, wouldn`t it be better if I can get the info generated put into a variable and then processed without the need to generate the file --> read it --> execute/fetch --> delete ??? Wouldn`t this be a good approach ??

Regards
Was This Post Helpful? 0
  • +
  • -

#4 aaron1178  Icon User is offline

  • Dovakiin, Dragonborn
  • member icon

Reputation: 169
  • View blog
  • Posts: 1,297
  • Joined: 22-October 08

Re: Php , Mysql and XML parsing

Posted 25 August 2011 - 04:44 AM

Indeed it would so. This would reduce resources and reduce better if not faster results.
Was This Post Helpful? 0
  • +
  • -

#5 momo1984  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 25-August 11

Re: Php , Mysql and XML parsing

Posted 25 August 2011 - 04:48 AM

View Postaaron1178, on 25 August 2011 - 04:44 AM, said:

Indeed it would so. This would reduce resources and reduce better if not faster results.

Thanks again. This really cleared my doubts :-)
Was This Post Helpful? 0
  • +
  • -

#6 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Php , Mysql and XML parsing

Posted 25 August 2011 - 05:23 AM

You can connect to your MySQL database directly from your computer if the host allows it. This would omit the need of a server side script to enter the data for you. If it's not possible then as aaron1178 suggested cURL can be of use to you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1