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('./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; } ?>
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!