-
Notifications
You must be signed in to change notification settings - Fork 1
/
examples.php
51 lines (30 loc) · 1.05 KB
/
examples.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
<?php
error_reporting(E_ERROR | E_PARSE);
require_once('getHeaders.class.php');
//REQUEST HTTP HEADERS
//Make a shell get headers request as mac/chrome browser
$h = new GetHeaders('mac');
//get all headers in variable
$headers = $h->get_shell_headers('http://www.youtube.com/');
var_dump($headers);
//HTTP HEADERS using best method available
//jsut pass URL to getHeaders method, which will decide and use best
// and fastest method to get and return headers
$h = new GetHeaders('mac');
$headers = $h->getHeaders('https://www.google.com/');
var_dump($h, $headers);
//CHECK SITE STATUS
//Site is up, correct URL, status 200 OK
if($headers['code'] === 200){
echo 'Site is up ';
}
//Site is up but moved to new URL,
//A missing https or slash at the end of URL also results in
//Status 301 Moved Perminantly
if($headers['code'] === 301){
echo 'Site new URL is '.$headers['location'];
}
//BENCHMARK PERFORMANCE
//An array of URLs to gauge performance, leave blank and
// Benchmark methods stored array of URLs would be used
$h->benchmarkRequest();