<?php

 // Define the URL we'll be pulling from
 $URL = "http://www.dilbert.com/";

 // Grab the full contents of the web page, 8192 bytes at a time until done
 $file = fopen("$URL", "r");
 $r = "";
 do {
    $data = fread($file, 8192);
    if (strlen($data) == 0) {
        break;
    }
    $r .= $data;
 } while (true);

// Define a Start & End location for the regular expression
$Start = 'value="/dyn/str_strip/';
$End = '.strip.print.gif';

// Grab the text between the Start & End location (ie. The picture name)
$stuff = eregi("$Start(.*)$End", $r, $content);

// Replace the stuff from the image string we aren't interested in (NOTE: a REGEX would be better)
$todaysDilbert = str_replace("value=\"","http://dilbert.com",$content[0]);

echo $todaysDilbert; // this will echo the image path from the Dilbert site
?> 

Page 1 of 22