All pastes #565165 Raw Edit

tfr

public text v1 · immutable
·published 2007-06-13 22:04 UTC
rendered paste body
Code:

			// Daily stats
			$METRIX_url_stats='https://www.google.com/analytics/reporting/export?fmt=1&id='.$srow['d_google_id'].'&pdr='.'20070601'.'-'.date('Ymd').'&cmp=average&rpt=DashboardReport';
			$response_stats=http_get($METRIX_url_stats, $HTTP_options_default, $response_info_stats);

			$start=strpos($response_stats,'<?xml');
			if ($start===FALSE)
			 {
				echo 'ERROR 1';
				return;
			 }
			else
			 {
				$response_stats=substr($response_stats,$start);
			 }
			$end=strpos($response_stats,'</AnalyticsReport>');
			if ($end===FALSE)
			 {
				echo 'ERROR 2';
				return;
			 }
			else
			 {
				$response_stats=substr($response_stats,0,$end+18);
			 }

var_dump($response_info_stats); echo "\n\n";

echo "content length: ".strlen($response_stats)."\n\n";

$fn='/tmp/'.uniqid().'.xml';
file_put_contents($fn,$response_stats);
echo "Result written to: ".$fn."\n\n";
	

Results:

array(27) {
  ["effective_url"]=>
  string(120) "https://www.google.com/analytics/reporting/export?fmt=1&id=1347788&pdr=20070601-20070614&cmp=average&rpt=DashboardReport"
  ["response_code"]=>
  int(200)
  ["total_time"]=>
  float(8.71855)
  ["namelookup_time"]=>
  float(0.007792)
  ["connect_time"]=>
  float(0.058452)
  ["pretransfer_time"]=>
  float(0.174288)
  ["size_upload"]=>
  float(0)
  ["size_download"]=>
  float(85131)
  ["speed_download"]=>
  float(9764)
  ["speed_upload"]=>
  float(0)
  ["header_size"]=>
  int(418)
  ["request_size"]=>
  int(384)
  ["ssl_verifyresult"]=>
  int(20)
  ["filetime"]=>
  int(-1)
  ["content_length_download"]=>
  float(0)
  ["content_length_upload"]=>
  float(0)
  ["starttransfer_time"]=>
  float(8.134278)
  ["content_type"]=>
  string(8) "text/xml"
  ["redirect_time"]=>
  float(0)
  ["redirect_count"]=>
  int(0)
  ["connect_code"]=>
  int(0)
  ["httpauth_avail"]=>
  int(0)
  ["proxyauth_avail"]=>
  int(0)
  ["os_errno"]=>
  int(0)
  ["num_connects"]=>
  int(1)
  ["ssl_engines"]=>
  array(9) {
    [0]=>
    string(7) "dynamic"
    [1]=>
    string(6) "cswift"
    [2]=>
    string(4) "chil"
    [3]=>
    string(6) "atalla"
    [4]=>
    string(5) "nuron"
    [5]=>
    string(5) "ubsec"
    [6]=>
    string(3) "aep"
    [7]=>
    string(8) "sureware"
    [8]=>
    string(7) "4758cca"
  }
  ["error"]=>
  string(0) ""
}


content length: 85235

Result written to: /tmp/467065f9a5222.xml