Parsing Google Analytics data with PHP – CSV files

This post shows how to extract data from an email attachment from data sent by Google Analytics with PHP. I’ve covered how to download and extract attachments with PHP’s IMAP functions in previous posts and am now coming to the end of this series finally showing how to get the data out of the attachments.

Categories PHP

Function to extract email attachments using PHP IMAP

This is a supplementary post in my series about having Google Analytics data sent by email and then downloading and parsing the data with PHP. This post simply contains a PHP function for extracting all the attachments of an email using the PHP IMAP functions into an array.

Categories PHP

Parsing Google Analytics data with PHP: A Series

At the start of 2009 I added a "Recent Posts" section to the sidebar navigation of this blog and decided I’d update it using data from Google Analytics. Unfortunately Analytics doesn’t have an API to get data but does have a function for sending data by email on regular basis either as a TSV, CSV, XML or PDF attachment.

Therefore a somewhat spordaic series of posts began appearing on this blog showing how to get Google Analytics data by email and use PHP’s IMAP functions to read through a mailbox and extract data from the attachments.

Categories PHP

Install PHP IMAP on Debian

 If you are getting the "Fatal error: Call to undefined function imap_open()" error in PHP when using the IMAP functions then they are not installed with your installation of PHP. This post looks at how to install the PHP IMAP functions on Debian and should also work for Ubuntu/Kubuntu/etc and other Debian derived Linux distros.

Fix the “call to undefined function curl_init” error in PHP on Debian

If you call the curl_init function in PHP and do not have the curl module installed you will get the error message "Fatal error: Call to undefined function curl_init() in /path/to/script.php on line XY". This post shows how to install the PHP curl module on Debian Linux and the instructions should also work on all Debian derived distros such as the Ubuntu family.