I've created a simple PHP script to scrape DuckDuckGo's html.duckduckgo.com. I'm looking to scrape more than the first page of results. The library I am using only supports GET requests and I can't seem to find the GET param that will show a new page of results.
Pressing the "next" button sends a POST request to DDG, and I've tried adding params from the POST request to the GET request with no luck.
Any idea how I could find the GET param to see the next page of results? Does such a thing even exist?
This is my current code, I'm using DiDOM.
<?php
require "../vendor/autoload.php";
use DiDom\Document;
$document = new Document('https://html.duckduckgo.com/html/?q=test', true);
$posts = $document->find('.result__url');
$links = [];
foreach($posts as $post) {
array_push($links, trim($post->text()));
}
$api = json_encode($links);
file_put_contents("links.json", $api);