Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Screen Scrape

  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Posts
    310
    Thanks
    86
    Thanked 3 Times in 3 Posts

    Screen Scrape

    Hi All,

    I'm trying to screen scrape a table on my site to another of my sites. However I just get a blank page:

    PHP Code:
    <?
    $htmlSrc
    ='http://www.sloughtownfc.net/league_table/index.php';
    function 
    captureFragment($str,$start_delim,$end_delim) {
    $start strpos($str,$start_delim) + strlen($start_delim);
    $end strpos($str,$end_delim,$start);
    return 
    substr($str,$start,$end $start);
    }

    $table captureFragment($htmlSrc,'<table width="100%" class="player_stats2">','</table>'); 
      
    ?>
    Any ideas?

    Thanks

    Chris

  • #2
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    You need to curl the webpage into a local variable using output buffering and then apply your captureFragment function. Or you can use file_get_contents (a lot easier), depending on your PHP setup.

    Please post again if you don't understand why!

    Regards,

    Mike.
    Last edited by mlse; 11-07-2007 at 05:52 PM.

  • Users who have thanked mlse for this post:

    stfc_boy (11-07-2007)

  • #3
    Regular Coder
    Join Date
    Jun 2007
    Posts
    310
    Thanks
    86
    Thanked 3 Times in 3 Posts
    Thanks. I'll take a look...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •