Created
October 18, 2016 06:01
-
-
Save chaegumi/c35897e9c7e53b408b44be6e43889c83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
// Set a valid header so browsers pick it up correctly. | |
header('Content-type: text/html; charset=utf-8'); | |
// Emulate the header BigPipe sends so we can test through Varnish. | |
header('Surrogate-Control: BigPipe/1.0'); | |
// Explicitly disable caching so Varnish and other upstreams won't cache. | |
header("Cache-Control: no-cache, must-revalidate"); | |
// Setting this header instructs Nginx to disable fastcgi_buffering and disable | |
// gzip for this request. | |
header('X-Accel-Buffering: no'); | |
if (ob_get_level() == 0) ob_start(); | |
ob_implicit_flush(true); | |
ob_end_flush(); | |
$file_content = file_get_contents(dirname(__FILE__) . '/emoticons.json'); | |
$objs = json_decode($file_content); | |
echo "Start down<br />\n"; | |
foreach($objs as $k=>$obj){ | |
$file_content1 = file_get_contents($obj->url); | |
file_put_contents($obj->md5 . '.gif', $file_content1); | |
echo "Downloading " . $k . "<br />\n"; | |
sleep(1); | |
} | |
echo "Download Complete<br />\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment