Created
August 13, 2022 12:00
-
-
Save Tonel/19b11a774381a3090d427e97a6029fcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| // iterate over all "/shop/page/X" pages and retrieve all product data | |
| for ($paginationNumber = 1; $paginationNumber <= $highestPaginationNumber; $paginationNumber++) { | |
| $curl = curl_init(); | |
| curl_setopt($curl, CURLOPT_URL, "https://scrapeme.live/shop/page/$paginationNumber/"); | |
| curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
| $pageHtml = curl_exec($curl); | |
| curl_close($curl); | |
| $paginationHtmlDomParser = HtmlDomParser::str_get_html($pageHtml); | |
| // scraping logic... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment