<?php
set_time_limit(0);
$handle = fopen('article.txt','r'); for($i=0;$i<1;$i++)
{
$count = 0;
while(!feof($handle)){
$count ++;
try{
$line = trim(fgets($handle));
if($line == '')
continue;
$temp = explode("|", $line);
ob_start();
readfile('http://img1.vip.com/upload/article/'.$temp[3]);
$img = ob_get_contents();
//var_dump($img);exit;
ob_end_clean();
$temp[2] = mb_substr($temp[2],0,7,'utf-8');
$temp[2] = trim($temp[2]);
$fp2=fopen('./pics/'.$temp[2].'.jpg', "a");
$test = fwrite($fp2,$img);
//var_dump($test);
fclose($fp2);
sleep(0.05);
} catch(Exception $e) {
echo ('http://img1.vip.com/upload/article/'.$temp[3]);
}
}
echo $count;
}