public static function view($id) { httpCls::$response = false; httpCls::set('host', crawlConf::$host); httpCls::set('uri', $id); httpCls::set('agent', crawlConf::$browser[0]['agent']); httpCls::set('accept', crawlConf::$browser[0]['accept']); httpCls::set('cookie', crawlConf::$browser[0]['cookie']); $rs = httpCls::send(); //返回内容 //httpCls::$response = (httpCls::unchunk2preg(httpCls::$response)); return httpCls::$response; }
public function img($url) { httpCls::$response = ''; $info = parse_url($url); httpCls::set('host', $info['host']); httpCls::set('uri', $info['path'] . '?' . $info['query']); httpCls::set('agent', crawlConf::$browser[0]['agent']); httpCls::set('accept', crawlConf::$browser[0]['accept']); httpCls::set('cookie', crawlConf::$browser[0]['cookie']); httpCls::set('timeout', 120); $rs = httpCls::down(); $content = httpCls::$response; $file = pathinfo($info['path']); $data = explode("\r\n\r\n", $content); file_put_contents(ROOT . 'img/' . $file['filename'] . '.jpg', $data[1]); return true; }