PHP實現批量擷取網頁中所有固定種子連結的方法

來源:互聯網
上載者:User
這篇文章主要介紹了PHP批量擷取網頁中所有固定種子連結的方法,涉及php字串與檔案操作的相關技巧,需要的朋友可以參考下

經常的下載連結比較多的時候,就像一次性將所有的連結添加到迅雷或者電爐,但是沒有在這種選項,怎麼辦,咱是PHPer啊,這事兒難不到咱

且看代碼,當然要換成你的,要根據具體情況來做修改。

<?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;  //說明特徵串連已經不存在 放棄尋找  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;}?>

以上就是本文的全部內容,希望對大家的學習有所協助。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.