An API for Google Alerts

Google recently enhanced Google Alerts such that it is possible to obtain RSS feeds of canned searches.

This is enormously useful but there is no API that enables one to programaticly list, add and remove items to their set of Google Alerts. So partly because it's too cold outside to do anything and partly because this seems like useful functionality I spend a few hours today writing a PHP class that implements an API to Google Alerts.

The only required input parameters for this class are the google account username and password. Reasonable defaults are chosen for all other parameters, which can be adjusted if needed.

  • username = [required] google account username
  • password = [required] corrosponding google account password
  • cookiefile = location of an alternate cookie file to be used. The cookie file manages and maintains the logged in session state.
  • useragent = adjust the user agent presented if you feel the need.
  • logtypes = an array containing the message types to be logged. Valid values are 'FATAL','ERROR','WARNING','INFO','DEBUG'.
  • logterm = a bool value that determines if log messages should be sent to terminal.

Some example class instantiations:-

  • $ga_api = new GoogleAlertApiClass('GOOGLE_USERNAME','GOOGLE_PASSWORD');
  • $ga_api = new GoogleAlertApiClass('GOOGLE_USERNAME','GOOGLE_PASSWORD',null,null,null,FALSE);
  • $ga_api = new GoogleAlertApiClass('GOOGLE_USERNAME','GOOGLE_PASSWORD',null,null,array('FATAL','ERROR','WARNING','INFO','DEBUG'),TRUE);

Functions available

  • alertList() -- Can be caled once a GoogleAlertApiClass has been created. Returns an array of alert terms and their respective RSS feed URLs.
  • alertAdd(string[TERM]) -- adds a new google alert. Returns 1 of sucess or 0 on failure.
  • alertRemove(string[TERM]) -- removes a google alert term. Returns 1 of sucess or 0 on failure.
  • alertEdit(string[OLD_TERM], string[NEW_TERM]) -- shortcut function, simply calls alertRemove and alertAdd on their respective terms. Returns 1.
  • log(BOOL) -- when input is FALSE, returns an array of the last 10 enabled log type messages. When input is FALSE returns as a string.

UPDATE: I wrote this API interface years ago now. While I do have a bigger, better, faster and much cleaner version it's not something that I'm ready to share for various reasons. If you have a genuine interest in obtaining the API feel free to contact me to discuss.

Hi, I would like to use your

Hi,

I would like to use your PHP class that access Google Alert.

Would you want to share it with me?

I would like to port your

I would like to port your code to Ruby and release it as open source. Would you like to share the code please, really want to avoid the rework. You can easily check that I am already contributing to several open source projects on code.google.com

Hi Nicholas, I'd also be

Hi Nicholas,
I'd also be interested in gaining access to your API and its documentation. As a project I'm trying to write my first web applet - a little script for managing and updating arrays of google alerts terms and the API would be key to the solution working. This will be my first experience of programming with APIs (back when I last programmed in 1990, I don't recall there being any...!) so if you can give me access, I would be thrilled.
With best wishes,
Simon
London, UK

Extremely interested in this.

Extremely interested in this. Please let me know how to obtain the code. Thanks.

I'd like to use that API. Is

I'd like to use that API. Is it available?

I am also very interested in

I am also very interested in your API. Please contact me.

Thanks,

JP

Hi can you share me your api

Hi

can you share me your api and where i can get it ?

Thanks

Hey Nicholas, This looks like

Hey Nicholas,

This looks like it could save me some effort, let me know if I can check it out.

Thanks!

Your code is very good, but

Your code is very good, but wher can I get it?

I am interested in your API

I am interested in your API could you please contact me to discuss.

Thanks,

LB

I’m impressed. Very

I’m impressed. Very informative and trustworthy blog does exactly what it sets out to do. I’ll bookmark your weblog for future use.

Joseph
www.joeydavila.com
Your online Library

I'm interested in your API

I'm interested in your API and am willing to pay for it.

Would love to access your API

Would love to access your API & code. Very useful.

Thank you.

Hi Could you please send me

Hi
Could you please send me the code and the documentation for your Google Alert API ?

please share the latest

please share the latest version of API

Can you please share the

Can you please share the latest version of the API?

Hi Nicholas, I'm looking for

Hi Nicholas,

I'm looking for a good Google Alerts (search) API. Is there any chance you could share your API code with me?

Looking forward to your reply.

Kind regards,
Don

Hey, this PHP Google Alert

Hey, this PHP Google Alert API is interesting. I'd like to get my hands on the code if you wouldn't mind. It seems like it's potentially a very powerful tool.

Thanks.

Hi! Could you please send me

Hi!

Could you please send me the code and the documentation for your Google Alert API for vb.net 2010?

Thanks and greetings.
Sumit

Hi, I'm, another person who

Hi,

I'm, another person who would be interested in using your API and would consider licensing it if the terms were reasonable.

Please contact me at your earliest convenience

Regards

Simon

Nicholas, I've been

Nicholas,

I've been attempting to write my own PHP API of sorts for Google Alerts to no avail... and it's quite frustrating.

I'd be very interested in your code for a personal project I have going on. Are you still sharing on a per-request basis? If so, it'd be greatly appreciated!

Thank you in advance.

Hi! Where can I get your

Hi! Where can I get your script? How much is it? Greetings!

I am very interested in your

I am very interested in your api, how I can do to get it.

Have you considered licensing

Have you considered licensing the use of your code? It looks like plenty of ppl would be happy to use it if it's cheap (this would be something I'd pay for on in ear monitors if it saves me a lot of time).

Just a thought
-

Hi, I would be interested in

Hi,
I would be interested in testing your API for one of my projects. Is it still available?
Thanks in advance for contacting me to discuss this. Best regards,
Mike
P.S: I have no homepage

Hi I am very interested in

Hi I am very interested in using this api. Where could I download this?

I would like to use your api

I would like to use your api for one of my projects , please contact so we can discuss the opportunity .

best regards

Hello, I'm very interested in

Hello,

I'm very interested in getting a copy of this API and even in contributing programming time to expand/fix it.

Let me know!
Thanks

Hi Nicholas, I am very

Hi Nicholas,

I am very interested in using your bigger, better, faster and much cleaner version of the API. Our application is written in PHP so it's a perfect fit. Would you mind sharing it with me?

Thanks!
Mark

Hello, I am trying to set up

Hello, I am trying to set up a free plagiarism and content monitoring service based on a set of words. This is exactly what we need; I am not even sure how else I could set this up. Please let me know, we are still in the process of setting up the website now and I would like to best it could be. Thank you.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.