-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
77 lines (67 loc) · 2.62 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
70
71
72
73
74
75
76
77
<?php
include('simple_html_dom.php');
if($_SERVER['REQUEST_METHOD'] == "POST"){
$urls = trim($_POST['urls']);
$urls = str_replace(array("\r\n", "\r"), "\n", $urls);
$urls = explode("\n", $urls);
$result = "";
foreach($urls as $url) {
$data = @file_get_html($url);
if (!empty($data)) {
$result .= '<div style="border: 1px solid #333333">';
$result .= '<p><a href="' . $url . '" target= "_brank">' . $url . '</a></p>';
foreach ($data->find('title') as $element) {
$result .= '<p><span class="bold">title</span><br />' . $element->plaintext . '</p>';
}
foreach ($data->find('meta') as $elements) {
if ($elements->getAttribute('name') == 'keywords') {
$result .= '<p><span class="bold">keywords</span><br />' . $elements->getAttribute('content') . '</p>';
}
}
foreach ($data->find('meta') as $elements) {
if ($elements->getAttribute('name') == 'description') {
$result .= '<p><span class="bold">description</span><br />' . $elements->getAttribute('content') . '</p>';
}
}
foreach ($data->find('link') as $elements) {
if ($elements->getAttribute('rel') == 'index') {
$result .= '<p><span class="bold">rel="index"</span><br />' . $elements->getAttribute('href') . '</p>';
}
}
foreach ($data->find('h1') as $element) {
$result .= '<p><span class="bold">h1 plaintext</span><br />' . $element->plaintext . '</p>';
}
foreach ($data->find('h1 img') as $element) {
$result .= '<p><span class="bold">h1 img alt</span><br />' . $element->getAttribute('alt') . '</p>';
}
$result .= '<p class="white">---------------------------------------------------------------</p>';
$result .= '</div>';
}
}
}
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>meta tag checker</title>
<style type="text/css">
.bold { font-weight: bold; }
.white { color: white; }
</style>
</head>
<body>
<h1>meta tag checker</h1>
<form action="" method="post">
<textarea placeholder="ここに1行1URLを貼り付ける!" name="urls" rows="20" cols="150"><?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
echo $_POST['urls'];
}
?></textarea>
<input type="submit" />
</form>
<div id="result">
<?php echo $result; ?>
</div>
</body>
</html>