-
Notifications
You must be signed in to change notification settings - Fork 716
/
Copy pathsettings.inc.sample
80 lines (70 loc) · 2.72 KB
/
settings.inc.sample
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
<?php
set_time_limit(0);
//error_reporting(0);
// global options
$video = true;
$private = false;
$docComplete = true;
$runs = 5;
$iterations = 1;
$fvonly = true;
$options = 'shard=0&discard=1&keepua=1';
$server = 'http://www.webpagetest.org/';
$key=''; // insert API key here
// list of permutations to test
$permutations = array();
$permutations['Original'] = array('location' => 'Dulles:Chrome.DSL', 'options' => 'script=addHeader%09X-Jpeg-Mode%3A%200%0AsetDns%09*%0972.66.115.11%0Anavigate%09%25URL%25');
$permutations['Optimized'] = array('location' => 'Dulles:Chrome.DSL', 'options' => 'script=addHeader%09X-Jpeg-Mode%3A%203%0AsetDns%09*%0972.66.115.11%0Anavigate%09%25URL%25');
$permutations['Progressive'] = array('location' => 'Dulles:Chrome.DSL', 'options' => 'script=addHeader%09X-Jpeg-Mode%3A%201%0AsetDns%09*%0972.66.115.11%0Anavigate%09%25URL%25');
$permutations['Truncated'] = array('location' => 'Dulles:Chrome.DSL', 'options' => 'script=addHeader%09X-Jpeg-Mode%3A%202%0AsetDns%09*%0972.66.115.11%0Anavigate%09%25URL%25');
$maxBandwidth = 3000;
$maxVariancePct = 20;
$metrics = array('TTFB', 'render', 'docTime', 'fullyLoaded', 'SpeedIndex', 'SpeedIndexDT', 'bytesInDoc', 'requestsDoc', 'domContentLoadedEventStart', 'visualComplete');
/**
* shared function to load the results file
*
* @param mixed $results
*/
function LoadResults(&$results)
{
$ret = false;
if( is_file('./results.json') ) {
$results = json_decode(file_get_contents('./results.json'), true);
if (is_array($results) && count($results)) {
$ret = true;
}
}
return $ret;
}
/**
* shared function to write out the results file
*/
function StoreResults(&$results) {
file_put_contents('./results.json', json_encode($results));
}
if (function_exists('curl_init')) {
$CURL_CONTEXT = curl_init();
if ($CURL_CONTEXT !== false) {
curl_setopt($CURL_CONTEXT, CURLOPT_RETURNTRANSFER, true);
curl_setopt($CURL_CONTEXT, CURLOPT_FAILONERROR, true);
curl_setopt($CURL_CONTEXT, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($CURL_CONTEXT, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($CURL_CONTEXT, CURLOPT_DNS_CACHE_TIMEOUT, 30);
curl_setopt($CURL_CONTEXT, CURLOPT_MAXREDIRS, 10);
curl_setopt($CURL_CONTEXT, CURLOPT_TIMEOUT, 30);
}
} else
$CURL_CONTEXT = false;
function http_fetch($url) {
$ret = null;
global $CURL_CONTEXT;
if ($CURL_CONTEXT !== false) {
curl_setopt($CURL_CONTEXT, CURLOPT_URL, $url);
$ret = curl_exec($CURL_CONTEXT);
} else {
$context = stream_context_create(array('http' => array('header'=>'Connection: close', 'timeout' => 600)));
$ret = file_get_contents($url, false, $context);
}
return $ret;
}
?>