-
Notifications
You must be signed in to change notification settings - Fork 0
/
crawling_result.php
170 lines (147 loc) · 5.62 KB
/
crawling_result.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
session_start();
if(isset($_SESSION['ok'])){
session_destroy();
}
else{
header("Location:crawl.php");
session_destroy();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mini Agent | Crawl Result </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/inuit.css">
<link rel="stylesheet" href="css/fluid-grid16-1100px.css">
<link rel="stylesheet" href="css/eve-styles.css">
<link rel="stylesheet" href="css/formalize.css">
<link rel="shortcut icon" href="icon.png">
<link rel="apple-touch-icon-precomposed" href="img/icon.png">
<script src="js/respond-min.js"></script>
<script src="js/jquery164min.js"></script>
<script src="js/jquery.formalize.min.js"></script>
<script type="text/javascript" src="date_time.js"></script>
<!--[if lte IE 7]>
<style>
hr { display:block; height:1px; border:0; border-top:1px solid #fff; margin:1em 0; padding:0; }
.grid-4{ width:22% }
</style>
<![endif]-->
</head>
<!--=============================================================== Logo, social and menu =====================================================================================-->
<body>
<script type="text/javascript">window.onload = date_time('date_time');</script>
<div class="wrapper"> <a href="index.html" id="logo"><img src="img/logo.png" alt="">
<h1 class="accessibility"></h1>
</a>
<div class="social"> <a href="#"><img src="img/facebook.png" width="20" height="20" alt=""></a> <a href="#"><img src="img/twitter.png" width="20" height="20" alt=""></a> <a href="#"><img src="img/linkedin.png" width="20" height="20" alt=""></a> <a href="#"><img src="img/vcard.png" width="20" height="20" alt=""></a> <a href="#"><img src="img/picasa.png" width="20" height="20" alt=""></a> </div>
<ul id="nav" class="main">
<li><a href="index.php">Home</a></li>
<li><a href="crawl.php" class="active">Crawl</a></li>
<li><a href="find.php">Find items</a></li>
<li><a href="https://scrapy.org/">Framework</a></li>
<li><a href="https://www.facebook.com/thawdezin">Contact</a></li>
</ul>
</div>
<!--end of wrapper div-->
<div class="clear"></div>
<!--=============================================================== Left content, address =====================================================================================-->
<div class="wrapper">
<div class="grids top">
<div class="grid-6 grid">
<div class="green bottom">
<h6>Check your previous input in here!</h6>
<table class="form">
<tr>
<th> <label for="env_name"> Anaconda Environment Name </label>
</th>
<td><?php echo $_REQUEST['env_name']; ?></td>
</tr>
<tr>
<th> <label for="spider_name"> Spider Name </label>
</th>
<td><?php echo $_REQUEST['spider_name']; ?></td>
</tr>
<tr>
<th> <label for="log_name"> Log File Name </label>
</th>
<td><?php echo $_REQUEST['log_name']; ?></td>
</tr>
<tr>
<th> <label for="proj_loc"> Project Location </label>
</th>
<td><?php echo $_REQUEST['proj_loc']; ?></td>
</tr>
</table>
</div>
<div class="green bottom">
<?php
$output = shell_exec('wmic cpu get loadpercentage');
echo $output; echo "<br />";
$ram_free = shell_exec('systeminfo |find "Available Physical Memory"');
echo $ram_free; echo "<br />";
?>
<script type="text/javascript">window.onload = date_time('date_time');</script>
</div>
<div>
<p class="message warning bottom">The <strong> output console </strong>is directly shown in right side.
<strong>Be patient! </strong> if nothing are shown in a small amount of time.
</p>
</div>
<a class="button" href="link.php">See details</a>
</div>
<!--=============================================================== Contact form =====================================================================================-->
<div class="grid-10 grid">
<h2>Crawling Console</h2>
<?php
ini_set('max_execution_time', 0);
$env_n = $_REQUEST['env_name'];
$spider_n = $_REQUEST['spider_name'];
$log_n = $_REQUEST['log_name'];
$proj_l = $_REQUEST['proj_loc'];
chdir($proj_l);
#chdir('C:\Users\thawd\thesis\agent');
echo '<pre>';
$cmd = "activate ".$env_n. " && scrapy crawl ".$spider_n." -s LOG_FILE=".$log_n."";
#passthru($cmd);
echo '</pre>';
while (@ ob_end_flush()); // end all output buffers if any
$proc = popen($cmd, 'r');
echo '<pre>';
while (!feof($proc))
{
echo fread($proc, 4096);
@ flush();
}
echo '</pre>';
?>
</div>
<!--end of grid-10-->
</div>
<!--end of grids-->
</div>
<!--end of wrapper-->
<!--=============================================================== Footer =====================================================================================-->
<div class="wrapper">
<div id="footer">
<div class="grids">
<div class="grid-5 grid text-center">
<p>© <a target="_blank" href="">Thaw De Zin</a></p>
</div>
<div class="grid-6 grid text-center">
<p>6IST-66</p>
</div>
<div class="grid-5 grid text-center">
<p>Contact me <a href="https://www.facebook.com/thawdezin">here</a></p>
</div>
</div>
<!--end of grids-->
</div>
<!--end of footer-->
</div>
<!--end of wrapper-->
</body>
</html>