'http://www.penny-arcade.com/comic/',
'urlPath' => 'http://www.penny-arcade.com',
'regexp' => '/
'penny.jpg'
),
array(
'url' => 'http://ctrlaltdel-online.com/comic.php',
'urlPath' => 'http://ctrlaltdel-online.com',
'regexp' => '/
/',
'imageFile' => 'ctrl.jpg'
),
array(
'url' => 'http://www.vgcats.com/comics/',
'urlPath' => 'http://www.vgcats.com/comics/',
'regexp' => '/
'vgcats.jpg'
),
array(
'url' => 'http://chugworth.com/comic.php',
'urlPath' => 'http://chugworth.com/',
'regexp' => "/
'chug.jpg'
),
array(
'url' => 'http://www.threepanelsoul.com/',
'urlPath' => '',
'regexp' => "/(http:\/\/www.threepanelsoul.com\/comics\/[0-9]+.gif)/",
'imageFile' => 'machall.jpg'
),
array(
'url' => 'http://userfriendly.org/',
'urlPath' => '',
'regexp' => '/
/',
'imageFile' => 'uf.gif'
),
array(
'url' => 'http://pvponline.com/',
'urlPath' => '',
'regexp' => '/
'pvp.gif'
),
array(
'url' => 'http://www.gocomics.com/foxtrot/',
'urlPath' => '',
'regexp' => '/
'ft.gif'
),
array(
'url' => 'http://www.dilbert.com/',
'urlPath' => 'http://www.dilbert.com',
'regexp' => '/
'dilbert.jpg'
),
array(
'url' => 'http://www.snoopy.com/',
'urlPath' => 'http://www.snoopy.com',
'regexp' => '/
'peanuts.jpg'
),
array(
'url' => 'http://www.comics.com/comics/pearls/',
'urlPath' => 'http://www.comics.com',
'regexp' => '/
'pearls.jpg'
),
array(
'url' => 'http://www.doonesbury.com/strip/dailydose/',
'urlPath' => '',
'regexp' => '/
'doonesbury.gif'
),
array(
'url' => 'http://www.gocomics.com/nonsequitur/',
'urlPath' => '',
'regexp' => '/
'nq.gif'
),
array(
'url' => 'http://seattlepi.nwsource.com/fun/mutts.asp',
'urlPath' => 'http://pst.rbma.com/content/',
'regexp' => '/(Mutts\?date=[0-9]+)/',
'imageFile' => 'mutts.gif'
),
array(
'url' => 'http://seattlepi.nwsource.com/fun/zits.asp',
'urlPath' => 'http://pst.rbma.com/content/',
'regexp' => '/(Zits\?date=[0-9]+)/',
'imageFile' => 'zits.gif'
),
array(
'url' => 'http://www.comics.com/comics/rudypark/',
'urlPath' => 'http://www.comics.com',
'regexp' => '/
'rudypark.jpg'
),
array(
'url' => 'http://www.wulffmorgenthaler.com/',
'urlPath' => 'http://www.wulffmorgenthaler.com/',
'regexp' => '/src="(striphandler.ashx\?stripid=[^"]+)"/i',
'imageFile' => 'wulf.gif'
),
array(
'url' => 'http://www.sinfest.net/',
'urlPath' => 'http://www.sinfest.net/',
'regexp' => '/
'sf.gif'
),
array(
'url' => 'http://www.tiraecol.net/modules/comic/',
'urlPath' => '',
'regexp' => '/
'tira.png'
),
array(
'url' => 'http://xkcd.com/',
'urlPath' => '',
'regexp' => '/
'xkcd.png'
),
array(
'url' => 'http://asofterworld.com/',
'urlPath' => '',
'regexp' => '/
'asofterworld.jpg'
),
array(
'url' => 'http://pbfcomics.com/feed/feed.xml',
'urlPath' => 'http://www.pbfcomics.com/archive/',
'regexp' => '/
.*cid=([A-Za-z0-9\_\-\.]+)/',
'imageFile' => 'pbfcomic.jpg'
),
array(
'url' => 'http://www.phdcomics.com/comics.php',
'urlPath' => '',
'regexp' => '/src=(http:\/\/www.phdcomics.com\/comics\/archive\/phd[0-9]+s.gif)/',
'imageFile' => 'phdcomic.gif'
),
array(
'url' => 'http://www.bugbash.net/',
'urlPath' => '',
'regexp' => '/(http:\/\/www.bugbash.net\/strips\/[a-z\-0-9]+.gif)/',
'imageFile' => 'bugbash.gif'
),
array(
'url' => 'http://www.catandgirl.com/',
'urlPath' => '',
'regexp' => '/(http:\/\/catandgirl.com\/archive\/cg[0-9a-z]+.gif)/',
'imageFile' => 'catandgirl.gif'
)
);
/* The program */
/* Get the image links */
for($i=0;$i
'.$comics[$i]['url'].'';
$comics[$i]['image'] = getImageLink($comics[$i]['url'],$comics[$i]['regexp']);
}
/* Get the images and write the html */
yoink($comics);
/* Functions */
function getImageLink($url,$regexp)
{
$html = getHtml($url);
preg_match($regexp,$html,$matches);
echo '';
print_r($matches);
echo '
';
return $matches[1];
}
function getHtml($url)
{
/* start curl */
$ch = curl_init();
/* set headers and stuff */
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_REFERER,$url);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (X11; U; Linux i386; en-US; rv:1.7.6) Gecko/20050512 Firefox');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,0);
$content = curl_exec($ch);
//echo $content;
curl_close($ch);
return $content;
}
function getImage($url,$filename)
{
global $path;
var_dump($url);
$ch = curl_init();
if (!file_exists($path.$filename)) {
touch($path.$filename);
}
$handle = fopen($path.$filename, "wb");
//var_dump($handle);
/* set headers and stuff */
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_REFERER,$url);
curl_setopt($ch,CURLOPT_FILE, $handle);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (X11; U; Linux i386; en-US; rv:1.7.6) Gecko/20050512 Firefox');
curl_setopt($ch,CURLOPT_HEADER,0);
curl_exec($ch);
echo $url;
//header('Content-Type: image/jpeg');
//var_dump( $content);
curl_close($ch);
fclose($handle);
chmod($path.$filename,0777);
/*$command = 'chown apache:apache '.$path.$filename.'';
echo $command;
echo exec($command);
echo '';
echo system('ls -al '.$path);
echo '
';*/
}
function yoink($comics)
{
$html =
'
The Raging Che » Comics
';
for($i=0;$i
';
}
$html .=
'
';
$handle = fopen($path.'comics.html', 'w');
fwrite($handle,$html);
fclose($handle);
}
?>