Currently does not exist an official api for google alerts, but with this php library you can create, read or delete
programmatically google alerts with minimum effort.
We have the library already implemented in many other programming languages like c# and java, contact us for more information.
//Create a new alert for the query 'php', with default values
$ga=new GAlerts('user', 'pass');
var_dump($alert); //print out the alert data
//Lists all alerts in the account
var_dump($lstAlerts); //print out the array of alerts
//Deletes the first alert of the account
The library simulates the requests to the service through curl in the same way as if you were accessing with a browser. The library is a small class with around 300 lines of code, three public methods with optional parameters. The code is exhaustively tested on many different servers, php versions, languages and locations.
Class library instantiation:
public function __construct($user, $pass, $timeout=30)
Create google alert api method:
/** * Creates a new alert in the system * @param string $query term to search for * @param string $lang language of the searches ('en', 'ca', 'es', 'fr'...) * @param string $frequency when the alerts are refreshed. Possible values: 'day', 'week', 'happens' * @param string $type type of the returned results. Possible values: 'all', 'news', 'blogs', 'videos', 'forums','books' * @param string $quantity number of results all or just the best. Possible values: 'best', 'all' * @param string $dest destination of the alert. Possible values: 'feed', 'email' * @return boolean true when success * @throws Exception when the server returns an incorrect response */ public function create($query, $lang='en', $frequency='happens', $type='all', $quantity='best', $dest='feed')
Delete google alert api method:
/** * Deletes an alert from the system * @param str $idAlert Can be obtained with create() or getList() methods * @return boolean true when success * @throws Exception when the server returns an incorrect response */ public function delete($idAlert)
List current google alerts api method:
/** * Returns an array with all the current alerts in the system * @return array with the keys: ('id', 'type', 'term', 'url'); * @throws Exception when the server returns an incorrect response */ public function getList()
Last update: 14/01/2017
For various reasons we are not sharing this class anymore.
You can buy the full source code with license without limits for 28€ / 29USD
We can provide an online demo before buying, if you have any question feel free to contact us at firstname.lastname@example.org, we will answer immediately. If you need this or similar functionality in any other language like perl, python, ruby or even as a webservice, contact us for more information.