READING XML parameters in PHP

Discussion in 'PHP' started by Tom_e_rock, Apr 29, 2006.

  1. #1
    http://www.youtube.com/api2_rest?me...tails&dev_id=0oTaJbGXflc&video_id=R0l9ZDn6GtU

    This is an XML file,

    I can call it and i get a bunch of this. I call echo $xml;

    <?xml version="1.0" encoding="utf-8"?> <ut_response status="ok"><video_details><author>tolgaa</author><title>nickelback 'saving me'</title><rating_avg>4.90</rating_avg><rating_co ........

    how do i get just <author> field for example.

    I tried $xml->ut_response-> ... but nothing works. I got php4 not php5. How do i do this??

    thanks
     
    Tom_e_rock, Apr 29, 2006 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to use an XML parser.

    PHP has one called expat, though whether or not this is installed by default, I don't know.

    If expat isn't installed, or you don't have access to the server to install the expat extension, check out miniXML from http://minixml.psychogenic.com/ . Note, I've never used it myself, but know of people that have...
     
    TwistMyArm, Apr 29, 2006 IP