preg_match_all help

Discussion in 'PHP' started by crazyryan, Jan 12, 2008.

  1. #1
    Hey, back again :D

    Basically, I want to grab videos from www.break.com homepage...

    I have this:
    $page = @file_get_contents("http://www.break.com/");
    
    preg_match_all("#<img src=\"([^<]*)\" class=\"v_thumb\" alt=\"([^<]*)\" height=\"100\" width=\"150\" border=\"0\" name=\"([^<]*)\" onError=\"SwapImage(this, 'http://media1.break.com/static/break/img/notavailable.gif');return true;\" />#", $page, $matches_title);
    print_r($matches_title);
    ?>
    PHP:
    I thought that would grab the title but obviously not...

    Effectively, for each media file on there I want to grab:

    <a href="/index/huge-bridge-demolition-causes-shockwave.html" alt="Huge Bridge Demolition Shockwave"><img src="http://media1.break.com/dnet/media/2008/1/huge-bridge-demolition-causes-shockwave.wmv.jpg" class="v_thumb" alt="Huge Bridge Demolition Shockwave" height="100" width="150" border="0" name="img431988" onError="SwapImage(this, 'http://media1.break.com/static/break/img/notavailable.gif');return true;" /></a>

    And also the description of the media, once I get that I should be able to handle everything else.

    Can anyone point me in the right direction?

    Thanks
     
    crazyryan, Jan 12, 2008 IP
  2. mvl

    mvl Peon

    Messages:
    147
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here you are:

    
    ...
    $page = @file_get_contents("http://www.break.com/");
    
    preg_match_all("#\<img src=\"([^\"]*)\" class=\"v_thumb\" alt=\"([^\"]*)\" height=\"100\" width=\"150\" border=\"0\" name=\"([^\"]*)\" onError=\"SwapImage\(this, 'http://media1.break.com/static/break/img/notavailable.gif'\);return true;\" \/\>#", $page, $matches_title);
    print_r($matches_title);
    ...
    
    PHP:
     
    mvl, Jan 12, 2008 IP