XML preg_match_all or ereg_match help needed.

Discussion in 'PHP' started by exodus, Nov 9, 2007.

  1. #1
    <item>
      <title>Pettidee -"I'm A Vet"</title>            
      <pubDate>Fri, 09 Nov 2007 00:04:05 -0800</pubDate>            
      <description><![CDATA[<img width="120" alt="Pettidee -&quot;I'm A Vet&quot;" height="90" src="http://site.com/475035.jpg" /> ]]></description>
      <category>im a vet</category><category>jason epperson</category><category>music video</category><category>pettidee</category>
      <link>http://site.com</link>
      <guid isPermaLink="true">http://site.com</guid>
    </item>
    Code (markup):
    I have the above xml syntax I am getting from a RSS feed. I am trying to get the <category> enclosures into an array that I could use. I suck at preg_match_all and ereg stuff. I was wondering if I could get some help in extracting that information from this xml example.


    .
     
    exodus, Nov 9, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Do you have PHP 5?
     
    nico_swd, Nov 9, 2007 IP
  3. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #3
    nico_swd.. no..

    I think I will try to use this..

    preg_match_all("'<category>(.*?)</category>'si", $rss_content, $tags);
    Code (markup):
    Have not tested it out yet, but will try right now.

    What does the si at the end mean? I never gotten around to learning Regular expressions. Just very very very easy basic regex stuff from examples I have seen. I do not understand it though.
     
    exodus, Nov 9, 2007 IP