-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
69 lines (60 loc) · 1.78 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
function get_all_captures($domain) {
$cdx_url = "http://web.archive.org/cdx/search/cdx?url={$domain}&output=json&fl=timestamp,original,mimetype,statuscode";
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $cdx_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
array_shift($data); // Remove the first row, which is just column names
return $data;
} catch (Exception $e) {
echo "Error accessing CDX API: " . $e->getMessage();
return [];
}
}
$domain = $_POST['domain'] ?? '';
$captures = $domain ? get_all_captures($domain) : [];
?>
<!DOCTYPE html>
<html lang="en">
<style>
.found-message {
color: white;
padding: 10px;
margin-top: 10px;
background-color: green;
border-radius: 5px;
text-align:center;
font-style: italic;
}
</style>
<form action="" method="post">
<input type="text" name="domain" placeholder="Enter domain" required>
<input type="submit" value="Cek">
</form>
<?php
if ($captures) {
echo "<div class='found-message'>" . count($captures) . " ARSIP DITEMUKAN</div>";
echo "<table>
<tr>
<th>TANGGAL</th>
<th>TIPE</th>
<th>CEK</th>
</tr>";
foreach ($captures as $capture) {
$date = DateTime::createFromFormat('YmdHis', $capture[0]);
$formattedDate = $date->format('Y-m-d, H:i:s');
$url = "http://web.archive.org/web/{$capture[0]}/{$capture[1]}";
echo "<tr>
<td>{$formattedDate}</td>
<td>{$capture[2]}</td>
<td><a href='{$url}' target='_blank'>CEK</a></td>
</tr>";
}
echo "</table>";
}
?>
</html>