Need To Find Solution to XML PARSEING

Discussion in 'Services' started by Tom_e_rock, Apr 30, 2006.

  1. #1
    I HTTP request the youtube API and get an XML response back.

    it looks like this but not shortened.

    <?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_count>87</rating_count><tags>nickelback saving me</tags><description>nickelback 'saving me'</description><update_time>1146386417</update_time><view_count>7529</view_count><upload_time>1143881446</upload_time><length_seconds>251</length_seconds><recording_date /><recording_location /><recording_country /><comment_list><comment><a

    blah blah blah.

    Now I need this to be read the "title" field seperartely. I need it so i can have a $title = ??????

    Basically I'm at $xml = alll that long code above.. I must parse it or something.

    Please help, if someone gives me a working solution I send $10 via paypal. Add me on msn even (tom_e_rock@msn.com)

    Thanks
     
    Tom_e_rock, Apr 30, 2006 IP
  2. adolix

    adolix Peon

    Messages:
    787
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    <?php

    $xml = "bla bla bla<title>Adolix simply rocks!</title>bla bla bla";

    $sc1 = "<title>"; // finder
    $sc2 = "</title>"; // finder


    $poz1 = strpos($xml, $sc1);
    $poz2 = strpos($xml, $sc2);
    $title=substr($xml, $poz1+7, $poz2-$poz1);
    echo "Title is :".$title;

    ?>

    Payment can be sent to paypal [at] adolix . com :)
     
    adolix, Apr 30, 2006 IP