Skip to content

Instantly share code, notes, and snippets.

@mgng
Created January 12, 2009 11:59
Show Gist options
  • Save mgng/45973 to your computer and use it in GitHub Desktop.
Save mgng/45973 to your computer and use it in GitHub Desktop.
??
<?php
// テスト
set_time_limit(600);
$tNum = 92;
$base = 'http://pic2ch.giox.org/';
$src = file_get_contents("{$base}thread/{$tNum}");
if ($src === false) {
exit('error');
}
$p1 = '/id\: \'([0-9]+)\/\'/';
$p2 = '/urls\: \[(.+)\],/';
preg_match($p1, $src, $m1);
preg_match($p2, $src, $m2);
if (!isset($m1[1]) || !isset($m2[1])) {
exit('not found');
}
$id = $m1[1];
$paths = explode(',', str_replace("'", '', $m2[1]));
if(mkdir($id) === false) {
exit('mkdir error');
}
foreach($paths as $path) {
$img = file_get_contents("{$base}images/pics/{$id}/{$path}");
if ($img !== false) {
file_put_contents("{$id}/{$path}", $img);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment