Home > Backend Development > PHP Tutorial > Climbing novel site

Climbing novel site

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 08:50:31
Original
1265 people have browsed it
It’s for my wife to read novels
The original site always pops up, just pop up, and there is a sound, what kind of sound is it?

Although it can be blocked with chrome, or you can write hosts, but change the site It's really troublesome to do it again.
  1. $base = 'http://xx/oo/';
  2. $start = 'xx.shtml';
  3. $content_grep = '/ (. *)
    /';
  4. $next_grep = '/href='(d+.shtml)'>Next page/';
  5. $next = $start;
  6. $file_name = 'out.txt';
  7. while($next) {
  8. echo 'getting ' . $next . PHP_EOL;
  9. $result = file_get_contents($base . $next);
  10. preg_match_all($content_grep, $result, $match );
  11. $isTitle = true;
  12. $content = "";
  13. foreach($match[1] as $line) {
  14. if($isTitle) {
  15. $content = $line . PHP_EOL . PHP_EOL;
  16. $isTitle = false;
  17. } else {
  18. $content .= ' ' . $line . PHP_EOL . PHP_EOL;
  19. }
  20. }
  21. $file = fopen($file_name, 'a');
  22. echo 'write length: ' . strlen( $content) .PHP_EOL;
  23. fwrite($file, $content);
  24. fclose($file);
  25. echo '.';
  26. preg_match($next_grep, $result, $match);
  27. $next = $match [1];
  28. }
Copy code


Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template