1. Home > programming >

php won't be a regular pain

It’s painful if you don’t know how to download Boomman. The only rule is found on the Internet. In the end, I used an explode to deal with it. None?php/** * Regular expression matches the required image* @return ArrayIterator $arr */function pregIMG($str){//$str ='a href="/articles/7442969" target="_blank"i

Will not download Boomman regularly It's painful, the only regular is found on the Internet, and finally I used the explode to deal with it, the newcomer, I beg Daniel to correct it.
'  ; $pattern='//i'; preg_match_all($pattern,$str,$matchs); return $matchs;} /*  * * Find the jpg of a page */ function getIMG($url,$dir){ if (empty($url)) return false; $cOntents = file_get_contents($url); $data = pregIMG($contents); $  jpgs = $data[1]; unset($data); $data = array(); foreach ($jpgs as $k => $v){ $t = explode('/', $v); if ($  t[3] =='large'){ $data[$k] = $v;}} if(!file_exists($dir) || !is_dir($dir)){ mkdir($dir,0777);}  $num = 1; foreach ($data as $v){ copy($v, $dir.'/'.time(). rand(10,100).'.jpg'); usleep(1); $num++;}  return $num;} function getBaoZou($page=1){ $url = "http://baozoumanhua.com/tucao/fresh/page/".$page."?sv=1395827058"; $dir = "public"  ; return getIMG($url, $dir);} function getMoreBaoZou($page){ /  /Download the first 10 pages $num = 0; for ($i = 1;$i <$page; $i++){ $num += getBaoZou($i);} echo'A total of downloads'.$num.'  Runaway Comics';} getMoreBaoZou(10);//Get the first 10 pages of Runaway Comics?>
Content recommendation: free high-definition PNG material download

This article is published by www.internetweblist.com and does not represent the position of www.internetweblist.com/:http://www.internetweblist.com/programming/82405.html

Contact Us

Online consultation:click here to give a message