Search inside XML with PHP

Discussion in 'PHP' started by danielldf, Aug 19, 2008.

  1. #1
    Hi i have the following problem i have an XML file with two main important infos called protest.xml

    inside the file ex:
    <protocol>853931</protocol>
    <situation>removed</situation>

    i want to add a field for any user in my site type a protocol and get back the situation of the protocol anyone knows how can i do that!?

    thankz
    Danielldf
     
    danielldf, Aug 19, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    I donot fully understand it, please give more details :)
     
    EricBruggema, Aug 19, 2008 IP
  3. danielldf

    danielldf Well-Known Member

    Messages:
    402
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #3
    wirh info!?

    let my try again

    i have an xml right!!? with multiple records. like:

    <protocol>853931</protocol>
    <situation>removed</situation>

    i want to add a field to vistors put the protocol number and hit 'search' the script will look into protocol inside xml and return for the user the content in next line between <situation>content</situation>

    ok?
     
    danielldf, Aug 19, 2008 IP
  4. gustavorg

    gustavorg Active Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #4
    Yes sure you need to parse the xml file using xml_parser_create ()/xml_parse (). If you need help with that I could provide you a full working script. pm for details.
     
    gustavorg, Aug 19, 2008 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    That's so 2004.

    Take a look at SimpleXML.
     
    nico_swd, Aug 19, 2008 IP