PHP Classes

File: utils/request.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Michele Andreoli  >  SmartGAPI  >  utils/request.php  >  Download  
File: utils/request.php
Role: Example script
Content type: text/plain
Description: script for the ajax request
Class: SmartGAPI
Display site statistics from Google Analytics
Author: By
Last change: Security bug fixed
Date: 4 years ago
Size: 1,361 bytes


Class file image Download
 * @author Michele Andreoli <>
 * @name request.php
 * @version 0.3 updated 07-04-2011
 * @license GNU Public License
 * @package SmartGAPI

    /***** BEGIN *****/
    /* This code retrieves informations from Google Analytics in background */

    /* E-MAIL */
$email = "<your email>";
$password = "<your password>";

$dir = $_POST['dir'];
$id = $_POST['id'];
$starting_date = $_POST['starting_date'];
$ending_date = $_POST['ending_date'];
$timezone = $_POST['timezone'];

$ga = new gapi($email, $password);
$ga->requestReportData($id, array('browser','browserVersion'), array('pageviews','visits'), null, null, $starting_date, $ending_date);
/***** END *****/
    <tr class="views">
        <td><?php echo $ga->getPageviews() ?></td>
    <tr class="visits">
        <td><?php echo $ga->getVisits() ?></td>
    <tr class="footer">
        <td><a href="">by Google Analytics</a></td>