How to extract data from web page?

Discussion in 'PHP' started by wll6568, May 3, 2007.

  1. #1
    Can someone tell me how to extract a portion of HTML codes from an existing web page? I tried to extract a table from a downloaded web page but cant get no luck:


     
    wll6568, May 3, 2007 IP
  2. bibel

    bibel Active Member

    Messages:
    289
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You can either professionally use a regular expression, or an old fashion strpos(), substr() combination. It's called grabbing.
     
    bibel, May 3, 2007 IP
  3. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #3
    As bibel says either use REGEX, or try to get desired portion via parsing the output.
     
    designcode, May 3, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    
    <?
    preg_match('~<div id="post_message_3018874">(.*?[^<])<br />~i', file_get_contents('http://forums.digitalpoint.com/showthread.php?t=319634'), $yourpost );
    echo $yourpost[1];
    
    PHP:
    Be more specific .......
     
    krakjoe, May 4, 2007 IP
  5. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #5
    Dam dude,....I think you know everything about php....

    You impress me with every post :)
     
    sundaybrew, May 4, 2007 IP