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"); print_r($http->getEntries()); $http->done(); */
// 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; } } } $http->done(); if ($output === 'js') { echo "var httpwatchapi = {};"; echo "\nhttpwatchapi.api = " . json_encode($api); echo "\nhttpwatchapi.paidproperties = " . json_encode($paidproperties); die; } echo '<?php $api = '; var_export($api); echo ';'; echo "\n", '$paidproperties = '; var_export($paidproperties); echo ';?>';