Location: PHPKode > scripts > SmartGAPI > utils/request.php
<?php
/**
 * @author Michele Andreoli <hide@address.com>
 * @name request.php
 * @version 0.2 updated 10-03-2011
 * @license http://opensource.org/licenses/gpl-license-php GNU Public License
 * @package SmartGAPI
 */

    /***** BEGIN *****/
    /* This code retrieves informations from Google Analytics in background */
    $dir = $_POST['dir'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    $id = $_POST['id'];
    $starting_date = $_POST['starting_date'];
    $ending_date = $_POST['ending_date'];
    $timezone = $_POST['timezone'];

    include_once $dir;
    $ga = new gapi($email, $password);
    $ga->requestReportData($id, array('browser','browserVersion'), array('pageviews','visits'), null, null, $starting_date, $ending_date);
    /***** END *****/
?>
<table>
    <tr class="views">
        <td>Pageviews</td>
        <td><?php echo $ga->getPageviews() ?></td>
    </tr>
    <tr class="visits">
        <td>Visits</td>
        <td><?php echo $ga->getVisits() ?></td>
    </tr>
    <tr class="footer">
        <td><a href="http://www.google.com/analytics/">by Google Analytics</a></td>
        <td></td>
    </tr>
</table>
Return current item: SmartGAPI