Results 1 to 4 of 4

Thread: PHP and XML

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

    Smile PHP and XML 10 Feb 2009 @ 20.16

    Hi,
    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 @ 21.34.
      Reply With Quote

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

    Default 16 Feb 2009 @ 22.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: jackfranklin.co.uk Blog: ispeakwebstuff.co.uk Project: learnitscreencasts.co.uk
    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
    Posts
    11

    Default 21 Apr 2009 @ 04.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
    Posts
    2,555
    Blog Entries
    3

    Default 21 Apr 2009 @ 07.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
  •