本文實(shí)例講述了PHP批量獲取網(wǎng)頁中所有固定種子鏈接的方法。分享給大家供大家參考,具體如下:
經(jīng)常的下載鏈接比較多的時(shí)候,就像一次性將所有的鏈接添加到迅雷或者電爐,但是沒有在這種選項(xiàng),怎么辦,咱是PHPer啊,這事兒難不到咱
且看代碼,當(dāng)然要換成你的,要根據(jù)具體情況來做修改。
<?phpheader("content-type:text/html;charset=utf8");$str = file_get_contents('./ShowFile.asp');$str1 = '<a href="ed2k';$str2 = '">';$pos1 = 0;$pos2 = 0;$pos3 = 0;$len = strlen($str);$ed2k = '';for($i=5000;$i<$len; ){ $pos1 = strpos($str,$str1,$i) + 9; $pos2 = strpos($str,$str2,$pos1) - 2; $pos3 = $pos2 - $pos1; //說明特征連接已經(jīng)不存在 放棄尋找 if($pos1 == 9){break;} $ed2k = substr($str,$pos1,$pos3+1)."/r/n"; file_put_contents('d:/log/a.txt',$ed2k,FILE_APPEND); echo substr($str,$pos1,$pos3+1).'<hr/>'; $i = $pos2;}?>希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選