
Untitled
By: a guest on
Mar 5th, 2014 | syntax:
PHP | size: 1.24 KB | views:
163 | expires: Never
<html>
<head>
<meta charset="UTF-8">
<title>SDSSKLÖFCJOIF</title>
<style>
@font-face {
font-family:DOS;
src: url(../../DOS.ttf);
}
* {
background-color: black;
color: rgb(192,192,192);
font-family: DOS, fixedsys, monospace;
font-size: 12pt;
}
</style>
</head>
<body>
<pre>
<?php
$tmp = file_get_contents("https://derpiboo.ru/images.json?key=q7VbqRzAz29aRVLFaoD4");
$imgdata = json_decode($tmp);
$imgstored = scandir("/mnt/poni/");
foreach ($imgstored as $key => $value) {
preg_match("/[0-9]+/", $value, $matches);
$imgstored[$key] = $matches[0];
}
$imgnew = array();
foreach ($imgdata->images as $img) {
array_unshift($imgnew, $img->id_number);
}
$imgnew = array_diff($imgnew,$imgstored);
$start_time = microtime(true);
foreach ($imgdata->images as $img) {
$filename = $img->id_number." - ".$img->created_at." - ".$img->file_name." - ".$img->tags.".".$img->original_format;
if(in_array($img->id_number, $imgnew)){
file_put_contents("/mnt/poni/".$filename, file_get_contents("http:".$img->image));
echo "[WRITE] ".$filename."\n";
}else{
echo "[SKIP] ".$filename."\n";
}
}
echo "downloaded in ".number_format(microtime(true) - $start_time, 8)." seconds\n";
?>
</pre>
</body>
</html>