-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathget_har.php
executable file
·44 lines (27 loc) · 1 KB
/
get_har.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
<?php
$base_dir = dirname(__FILE__);
# Load main config file.
require_once $base_dir . "/conf_default.php";
require_once $base_dir . "/tools.php";
# Include user-defined overrides if they exist.
if( file_exists( $base_dir . "/conf.php" ) ) {
include_once $base_dir . "/conf.php";
}
#header('Content-type: application/json');
header('Content-type: text/plain');
if ( isset($_GET['url'])) {
$url = validate_url($_GET['url']);
if ( $url === FALSE ) {
print json_encode( array( "error" => "URL is not valid" ) );
exit(1);
}
isset($_REQUEST['include_image']) && $_REQUEST['include_image'] == 1 ? $include_image = true : $include_image = false;
isset($_REQUEST['harviewer']) && $_REQUEST['harviewer'] == 1 ? $harviewer = true : $harviewer = false;
$results = get_har_using_phantomjs($url, $include_image, $harviewer );
if ( $harviewer )
print "onInputData(";
print json_encode($results);
if ( $harviewer )
print ");";
}
?>