Skip to content

Instantly share code, notes, and snippets.

@Tonel
Created August 13, 2022 12:05
Show Gist options
  • Save Tonel/e8795ee1a9089f0d4c6f4957a550b608 to your computer and use it in GitHub Desktop.
Save Tonel/e8795ee1a9089f0d4c6f4957a550b608 to your computer and use it in GitHub Desktop.
<?
$from = null;
$to = null;
if (isset($_GET["from"]) && is_numeric($_GET["from"])) {
$from = $_GET["from"];
}
if (isset($_GET["to"]) && is_numeric($_GET["to"])) {
$to = $_GET["to"];
}
if (is_null($from) || is_null($to) || $from > $to) {
die("Invalid from and to parameters!");
}
// scrape only the pagination pages whose number goes
// from "$from" to "$to"
for ($paginationNumber = $from; $paginationNumber <= $to; $paginationNumber++) {
// scraping logic...
}
// write the data scraped to a database/file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment