Simple Pregmatch help

Discussion in 'PHP' started by ruby90, Jul 15, 2008.

  1. #1
    I needs to extract google search result urls

    like

    First search url

    Second search url

    Third search url

    etc... I'm looking some dp expert's help for this :D

    Thanks,
    ruby :)
     
    ruby90, Jul 15, 2008 IP
  2. ruby90

    ruby90 Peon

    Messages:
    721
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Changed Mind Now I needs to extract

    http://www.wpthemesgallery.com/make-money-online-with-tnx/

    http://www.blogsforfood.com/article/4


    from

    
    <h2 class=r><a href="http://www.wpthemesgallery.com/make-money-online-with-tnx/" class=l onmousedown="return clk(this.href,'','','res','12','')"><b>Make Money Online</b> with TNX | WP Themes Gallery</a></h2>
    
    <h2 class=r><a href="http://www.blogsforfood.com/article/4" class=l onmousedown="return clk(this.href,'','','res','13','')">AdSense-Deluxe - WordPress plugin that helps us to <b>make money</b> <b>...</b></a></h2>
    
    HTML:
    I'm looking your quick help :D
     
    ruby90, Jul 15, 2008 IP
  3. Kendothpro

    Kendothpro Well-Known Member

    Messages:
    574
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #3
    preg_match_all('#href="(.*)"#isU',$variablecontainingthecodetomatch,$variablethatwillcontainthematchedurls);
    PHP:
    Your stuff will be in $variablethatwillcontainthematchedurls[1] as an array

    If you didn't understand google "php preg_match_all" and read :D
     
    Kendothpro, Jul 15, 2008 IP
  4. ruby90

    ruby90 Peon

    Messages:
    721
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks but can you post here some complete code for it :D I much appreciate rep added :)
     
    ruby90, Jul 19, 2008 IP