标签:actor xls 抓取 epo hpc ram com https ice
public function stock(){ $curl = new Curl(); $curl->setUserAgent(‘Mozilla/5.0‘); $curl->get(‘http://stock.gtimg.cn/data/get_hs_xls.php?id=ranka&type=1&metric=chr‘); $file_name = date(‘Ymd‘).‘.xls‘; if ($curl->error) { echo $curl->error_code; } else { file_put_contents($file_name, $curl->response); //echo $curl->response; $objPHPExcel = \PHPExcel_IOFactory::load($file_name); $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); // 取得总行数 $highestColumn = $sheet->getHighestColumn(); // 取得总列数 $objdata = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); dump($objdata); } $curl->close(); }
composer
{ "require": { "php": ">=5.4.0", "topthink/framework": "^5.0", "phpoffice/phpexcel": "^1.0", "curl/curl": "^1.0" }, "repositories": { "packagist": { "type": "composer", "url": "https://packagist.phpcomposer.com" } } }
标签:actor xls 抓取 epo hpc ram com https ice
原文地址:http://www.cnblogs.com/nowphp/p/6654054.html