Tell me, is there an example code?

<?php $i=0; $html = file_get_contents('https://site.ru/page/1'); ... ?> 

How to copy all code in notepad ++ in one fell swoop, for example, 100 times by replacing page / 1 with a loop to page / 100? If possible, tell me how.

The result is something like this:

 <?php $i=0; $html = file_get_contents('https://site.ru/page/1'); ... ?> <?php $i=0; $html = file_get_contents('https://site.ru/page/2'); ... ?> 

---...---

 <?php $i=0; $html = file_get_contents('https://site.ru/page/100'); ... ?> 
  • one
    You can, of course, write your own macro ... but a hundred times faster to copy this crap into Excel, multiply there with an increment, and return it back. - Akina

1 answer 1

No, because the development of notepad ++ did not count on such a train of thought. And what's the problem to write:

 <?php $i = 0; for($j = 0; $j < 100; $j++) { $html = file_get_contents('https://site.ru/page/'.$j); // ... } ?> 

and just delete the rest? )

  • I have $ i already in use - user317795
  • <? php $ i = 0; $ html = file_get_contents (' site.ru/page/1' ); preg_match_all ('# <div class = "item"> (. +?.) </ div> #is', $ html, $ matches); foreach ($ matches [1] as $ value) {$ i ++; echo $ value. '<br>'; if ($ i == 10) break; }?> - user317795
  • one
    Corrected according to your comments) - Alexander Chernin
  • thanks, it worked! - user317795
  • Feel the power of the cycle! Please)) - Alexander Chernin