修改:/e/class/connect.php文件
在該文件最上面加上以下函數(shù)
- //獲取https鏈接內(nèi)容
- function?getHTTPS($url)?{
- ????????$ch?=?curl_init();
- ????????curl_setopt($ch,?CURLOPT_SSL_VERIFYPEER,?FALSE);
- ????????curl_setopt($ch,?CURLOPT_HEADER,?false);
- ????????curl_setopt($ch,?CURLOPT_FOLLOWLOCATION,?true);
- ????????curl_setopt($ch,?CURLOPT_URL,?$url);
- ????????curl_setopt($ch,?CURLOPT_REFERER,?$url);
- ????????curl_setopt($ch,?CURLOPT_RETURNTRANSFER,?TRUE);
- ????????$result?=?curl_exec($ch);
- ????????curl_close($ch);
- ????????return?$result;
- }
找到ReadFiletext函數(shù)如下代碼
- function?ReadFiletext($filepath){
- ????$filepath=trim($filepath);
- ????$htmlfp=@fopen($filepath,"r");
- ????//遠程
- ????if(strstr($filepath,"://"))
- ????{
- ????????while($data=@fread($htmlfp,500000))
- ????????{
- ????????????$string.=$data;
- ????????}
- ????}
- ????//本地
- ????else
- ????{
- ????????$string=@fread($htmlfp,@filesize($filepath));
- ????}
- ????@fclose($htmlfp);
- ????return?$string;
- }
改成
- function?ReadFiletext($filepath){
- ????$filepath=trim($filepath);
- ????$htmlfp=@fopen($filepath,"r");
- ????//遠程
- ????if(strstr($filepath,"https://")){
- ????????????????return?getHTTPS($filepath);
- ????????}
- ????if(strstr($filepath,"://"))
- ????{
- ????????while($data=@fread($htmlfp,500000))
- ????????{
- ????????????$string.=$data;
- ????????}
- ????}
- ????//本地
- ????else
- ????{
- ????????$string=@fread($htmlfp,@filesize($filepath));
- ????}
- ????@fclose($htmlfp);
- ????return?$string;
- }
自此可實現(xiàn)采集https開頭的網(wǎng)頁鏈接
版權(quán)聲明:文章圖片資源來源于網(wǎng)絡,如有侵權(quán),請留言刪除!!!
評論