Home >Backend Development >PHP Tutorial >PHP method to obtain all fixed seed links in a web page in batches

PHP method to obtain all fixed seed links in a web page in batches

墨辰丷
墨辰丷Original
2018-05-30 16:27:031771browse

This article mainly introduces the method of PHP batch acquisition of all fixed seed links in web pages, involving related skills of PHP string and file operations. Friends in need can refer to it

There are more frequent download links When , it’s like adding all the links to Thunder or Electric Stove at once, but there is no such option. What should I do? We are PHPer. This matter is not difficult for us

Let’s see Of course, the code must be replaced with yours, and modifications must be made according to the specific situation.

<?php
header("content-type:text/html;charset=utf8");
$str = file_get_contents(&#39;./ShowFile.asp&#39;);
$str1 = &#39;<a href="ed2k&#39;;
$str2 = &#39;">&#39;;
$pos1 = 0;
$pos2 = 0;
$pos3 = 0;
$len = strlen($str);
$ed2k = &#39;&#39;;
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(&#39;d:/log/a.txt&#39;,$ed2k,FILE_APPEND);
  echo substr($str,$pos1,$pos3+1).&#39;<hr/>&#39;;
  $i = $pos2;
}
?>

The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

Detailed explanation of the method of storing/depositing PHPSession into redis

ajax implementation call returnphpInterface method to return json data

phpMethod to obtain parameters in cli mode

The above is the detailed content of PHP method to obtain all fixed seed links in a web page in batches. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn