ara.php: <?php
require 'vendor/autoload.php';
$keyword = $_GET['q'];
$client = new GuzzleHttpClient();
$response = $client->request('GET', 'http://search.com.tr/ozel-domain/'.$keyword.'-tr.html');
$html = $response->getBody();
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
foreach ($xpath->query('//k') as $node) {
$node->parentNode->removeChild($node);
}
$div_tags = $dom->getElementsByTagName('div');
foreach ($div_tags as $tag) {
if ($tag->getattribute('class') === 'domain_ic_sag_son') {
$tag->parentNode->removeChild($tag);
}
}
$xpath = new DOMXPath($dom);
$elements = $xpath->query("//div[@class='domain']//a");
$results = array();
foreach ($elements as $element) {
$results[] = $element->nodeValue;
}
$date = date("d");
$months = array("Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık");
$month = $months[date('m', strtotime(date("d F Y"))) - 1];
$year = date("Y");
$days = array("Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar");
$day = $days[date('N', strtotime(date("d F Y"))) - 1];
require_once 'result.php';
[B][/B]index.php: <!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form action="ara.php" method="get">
<label for="q">Anahtar Kelime:</label>
<input type="text" id="q" name="q">
<input type="submit" value="Git">
</form>
</body>
</html>
[B][/B] result.php: <!DOCTYPE html>
<html>
<head>
<title>Arama Sonuçları</title>
</head>
<body>
<form action="ara.php" method="get">
<label for="q">Anahtar Kelime:</label>
<input type="text" id="q" name="q">
<input type="submit" value="Git">
</form>
<h1>Arama Sonuçları</h1>
<div>
<p>Aranan kelime: <?php echo $keyword; ?></p>
<p>Düşen domainlerin tarihi: <?php echo $date . ' ' . $month . ' ' . $year . ' ' . $day ?></p>
</div>
<div>
<ul>
<?php
foreach($results as $result) {
if(!empty($result)){
echo '<li>' . $result . '</li>';
echo '<a href="/whois/'.$result.'" class="btn">Whois</a> <br>';
}
}
?>
</ul>
</div>
</body>
</html>
[B][/B] Komut satırına: composer require guzzlehttp/guzzle