Beispiel #1
0
$http->watch->Clear();
$http->go('http://google.com');
$sum = $http->watch->Log->Entries->Summary;
echo "in: {$sum->BytesReceived}, out: {$sum->BytesSent}";
*/
// 2.
//$http->skipStreams = false;
//$entries = $http->getEntries();
//print_r($entries);
// 3.
// echo print_r(json_decode($http->toHAR()));
// 4.
$ie = new HTTPWatch();
$ie->go('http://google.com/');
$sum = $ie->getSummary();
$ff = new HTTPWatch('ff');
$ff->go('http://google.com/');
$sumff = $ff->getSummary();
echo "\nRun 1 ";
echo $ie->watch->Log->BrowserName, ' ';
echo $ie->watch->Log->BrowserVersion;
echo "\nSent: ", $sum['BytesSent'], "; Received: ", $sum['BytesReceived'];
echo "\nRun 2 ";
echo $ff->watch->Log->BrowserName, ' ';
echo $ff->watch->Log->BrowserVersion;
echo "\nSent: ", $sumff['BytesSent'], "; Received: ", $sumff['BytesReceived'];
$ie->done();
$ff->done();
/*
$http = new HTTPWatch();
$http->go("http://givepngachance.com");
Beispiel #2
0
// properties from them
$classes = array('Entry' => $item, 'Content' => $item->Content, 'Summary' => $summary, 'CacheInfo' => $item->CacheBefore, 'Request' => $item->Request, 'Response' => $item->Response, 'Timings' => $item->Timings, 'Timing' => $item->Timings->Blocked, 'Cookie' => $item->Request->Cookies->Item(0), 'Warning' => $plug->Log->Entries->Item(3)->Warnings(0), 'WarningSummary' => $summary->WarningSummaries(0), 'ResultSummary' => $summary->StatusCodes(0), 'TimingSummaries' => $summary->TimingSummaries, 'TimingSummary' => $summary->TimingSummaries->Blocked, 'Header' => $item->Request->Headers->Item(0), 'QueryStringValue' => $item->Request->QueryStringValues->Item(0));
// exceptions:
// + members that are lists
// + members that are objects of a class not matching their name
// + unsupported members
$object_values = array('Cookies' => array('Cookie'), 'Entries' => array('Entry'), 'Headers' => array('Header'), 'Pages' => array('Page'), 'PageEvents' => array('PageEvent'), 'POSTParameters' => array('POSTParameter'), 'QueryStringValues' => array('QueryStringValue'), 'ResultSummaries' => array('ResultSummary'), 'Warnings' => array('Warning'), 'WarningSummaries' => array('WarningSummary'), 'CacheBefore' => 'CacheInfo', 'CacheAfter' => 'CacheInfo', 'Errors' => array('ResultSummary'), 'StatusCodes' => array('ResultSummary'), 'Events' => 'PageEvents', 'Page' => false);
// list-like members that are actually not lists
$class_values = array('Timings' => 'Timing', 'TimingSummaries' => 'TimingSummary');
$api = dumpAPI($classes, $object_values, $class_values);
$http->done();
sleep(2);
// Test for properties that are only in the paid version
// except for some top sites and their URLs and CDNs
$paidproperties = array();
$http = new HTTPWatch();
$http->go('http://www.phpied.com/images/underline.gif');
// some vars for short
$plug =& $http->watch;
$entry = $http->watch->Log->Entries->Item(0);
$summary = $http->watch->Log->Entries->Summary;
$these = array('Entry' => $entry, 'Summary' => $summary);
foreach ($these as $class => $obj) {
    foreach ($api[$class] as $prop => $ignore) {
        try {
            $foo = $obj->{$prop};
        } catch (Exception $e) {
            $paidproperties[$prop] = 1;
        }
    }
}