Results 1 to 4 of 4

Thread: PHP and XML

  1. #1
    New Registered User narolis's Avatar
    Join Date
    Feb 2009

    Smile PHP and XML 10 Feb 2009 @ 21.16

    I am developing a website with users using some XML.

    I would like to know what is the best and must optimized way to read and write XML with PHP. Currently I made some test with " new DOMDocument();" it work well but is it the best way to do it?

    And is it best to read a big XML that contain many info or to split it in many little XML that contain less info, and to read them one after the other?

    And do you have any good tips of PHP optimizations, what not to do or use and what to make to optimize.

    One last question, what happen if a user must update an XML and at the same time an other user must write in the same XML? It will create a conflict, anyone have ideas to solve that problem?

    Thank you
    Last edited by narolis; 10 Feb 2009 at @ 22.34.
      Reply With Quote

  2. #2
    Trusted Guru Jack Franklin's Avatar
    Join Date
    Dec 2008
    Blog Entries

    Default 16 Feb 2009 @ 23.02

    This tut - Build a Login and Registration System with XML - NETTUTS goes through creating a log-in system with PHP + XML, might help you out.
    Site: Blog: Project:
    I'm available for 1 to 1 lessons on HTML/CSS/PHP/Javascript/jQuery/Photoshop/Fireworks so please PM Me!
      Reply With Quote

  3. #3
    Junior Member Haneul Sang's Avatar
    Join Date
    Apr 2009

    Default 21 Apr 2009 @ 05.51

    you can store your data in XML instead of a database. but that will cost you a lot of performance. XML is not a fast format, by no means. especially editing XML or inserting data in the middle is slow, and the parsing is slow, too. A real database with indices etc is way faster, but maybe it consumes some kb more (because of the indices), and it runs as a daemon in the background (but mysql doesn't need resources if it's idle).

    So i would really strongly recommend to use MySQL...
      Reply With Quote

  4. #4
    Trusted Guru WelshStew's Avatar
    Join Date
    Dec 2008
    Blog Entries

    Default 21 Apr 2009 @ 08.53

    I would echo Haneul on this one, and get the xml feed into a mySQL db and then use php to pull from the db.

    This will save you lots of resources and if for some unknown reason the xml feed fails, your site won't go down, it just won't update. Therefore, your users are not impacted as much.

    You will need to use some sort or parser, such as xpath, in order to get it into the db.
      Reply With Quote

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts