2022-02-24 11:30:15 +01:00
|
|
|
<?php
|
|
|
|
function get_base_url($url)
|
|
|
|
{
|
|
|
|
$split_url = explode("/", $url);
|
|
|
|
$base_url = $split_url[0] . "//" . $split_url[2] . "/";
|
|
|
|
return $base_url;
|
|
|
|
}
|
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
function get_xpath($response)
|
2022-02-24 11:30:15 +01:00
|
|
|
{
|
2022-02-25 10:42:32 +01:00
|
|
|
$htmlDom = new DOMDocument;
|
|
|
|
@$htmlDom->loadHTML($response);
|
|
|
|
$xpath = new DOMXPath($htmlDom);
|
2022-02-24 11:30:15 +01:00
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
return $xpath;
|
2022-02-24 11:30:15 +01:00
|
|
|
}
|
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
function request($url)
|
2022-02-24 11:30:15 +01:00
|
|
|
{
|
2022-02-25 10:42:32 +01:00
|
|
|
require "config.php";
|
2022-02-24 22:29:10 +01:00
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
$ch = curl_init($url);
|
|
|
|
curl_setopt_array($ch, $config_curl_settings);
|
|
|
|
$response = curl_exec($ch);
|
2022-02-24 22:29:10 +01:00
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
return $response;
|
2022-02-24 11:30:15 +01:00
|
|
|
}
|
|
|
|
|
2022-02-25 10:42:32 +01:00
|
|
|
function print_next_page_button($text, $page, $query, $type)
|
2022-02-24 11:30:15 +01:00
|
|
|
{
|
|
|
|
echo "<form id=\"page\" action=\"search.php\" target=\"_top\" method=\"post\" enctype=\"multipart/form-data\" autocomplete=\"off\">";
|
|
|
|
echo "<input type=\"hidden\" name=\"p\" value=\"" . $page . "\" />";
|
2022-02-25 10:42:32 +01:00
|
|
|
echo "<input type=\"hidden\" name=\"q\" value=\"$query\" />";
|
2022-02-24 11:30:15 +01:00
|
|
|
echo "<input type=\"hidden\" name=\"type\" value=\"$type\" />";
|
2022-02-25 10:42:32 +01:00
|
|
|
echo "<button type=\"submit\">$text</button>";
|
2022-02-24 11:30:15 +01:00
|
|
|
echo "</form>";
|
|
|
|
}
|
|
|
|
?>
|