{"id":23840479,"url":"https://github.com/trivo25/google-alerts-api-php","last_synced_at":"2025-10-17T21:25:23.046Z","repository":{"id":38270012,"uuid":"379938905","full_name":"Trivo25/google-alerts-api-php","owner":"Trivo25","description":"A PHP library for creating google alert feeds","archived":false,"fork":false,"pushed_at":"2021-08-05T11:15:47.000Z","size":6,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-02T17:56:37.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Trivo25.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-24T13:44:46.000Z","updated_at":"2022-06-23T03:32:22.000Z","dependencies_parsed_at":"2022-08-18T07:16:04.035Z","dependency_job_id":null,"html_url":"https://github.com/Trivo25/google-alerts-api-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trivo25%2Fgoogle-alerts-api-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trivo25%2Fgoogle-alerts-api-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trivo25%2Fgoogle-alerts-api-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trivo25%2Fgoogle-alerts-api-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trivo25","download_url":"https://codeload.github.com/Trivo25/google-alerts-api-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240127087,"owners_count":19751938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T17:56:38.895Z","updated_at":"2025-10-17T21:25:22.969Z","avatar_url":"https://github.com/Trivo25.png","language":"PHP","readme":"# google-alerts-api-php\n\n**_This API Client is still WIP and only allows access to the CREATE and DELETE endpoints for Google Alerts._**\n\n**Thanks to github.com/adasq/google-alerts-api for developing a NodeJS version**\n\nA Google Alerts API that allows you to create Google Alerts via PHP and have them delievered to a RSS feed.\n\n## The API currently only supports\n\n- **creating alerts**\n- **Removing alerts**\n\n## Usage\n\n#### NOTICE: Login via password and email is not possible (yet?) because google has changed their auth procedure. Only login with pre-defined cookies is working. See below for example\n\nCopy the `GoogleAlert.php` class and the `config.php` from `google-alerts-api/GoogleAlert.php` into your project folder.\n\nEdit the `config.php` and enter your base64 encoded cookies. (See below for an explanation)\n\n(See `google-alerts-api/example.php` for a working example)\n\n```php\n  // creating a Google Alert object\n  $ga = new GoogleAlert();\n\n  /*\n    creating a new google alert\n\n    params      default-value     explanation\n\n    $query      *none* required  name/title/query for the alert\n    $lang       'en'              language of the alert results; 'en', 'de', 'ru'..\n    $frequency  'happens'         how often new items should be delievered to the feed\n    $type       'all'             type of source for new feed items. All includes blogs, news, etc.\n    $quantity   'best'            returns only best results\n  */\n\n  /*\n    creates the alert and returns the feed and the googleid\n    (googleid is needed incase you want to delete an alert using the script)\n  */\n  $alert = $ga-\u003ecreate(\"Satoshi Nakamoto\");\n  echo json_encode($alert);\n\n  /*\n  {\n    \"rss\": \"https://www.google.de/alerts/feeds/somerssfeed/123\",  // rssfeed:   articles will be delivered to this feed\n    \"googleid\": \"12341234b12341:a112341239364456:com:de:DE\"       // googleid:  needed to delete and modify alerts\n  }\n*/\n```\n\nDeleting an alert by id\n\n```php\n  // deleting a Google Alert object\n  $ga = new GoogleAlert();\n  $ga-\u003edelete(\"12341234b12341:a112341239364456:com:de:DE\");\n```\n\n### Generating cookies:\n\nCookies need to be pre-generated. Once you authenticated and logged in using your browser you can easily copy the cookies and save them in the `config.php`.\n\n#### Logging in using the browser\n\nOpen Chrome in Incognito mode and login into `http://myaccount.google.com` using the account you want to use.\n\n#### Copy SID, HSDI and SSID\n\n1. Open dev tools\n2. Go to **Application** and select **Cookies** for http://myaccount.google.com\n3. Copy **SID**, **HSID** and **SSID** values\n\n#### Turn your cookies into a base64 encoded auth string\n\n1. Fill your cookie values into the given JSON object\n\n```js\nwindow.btoa(\n  JSON.stringify([\n    {\n      key: \"SID\",\n      value: \"\",\n      domain: \"google.com\",\n    },\n    {\n      key: \"HSID\",\n      value: \"\",\n      domain: \"google.com\",\n    },\n    {\n      key: \"SSID\",\n      value: \"\",\n      domain: \"google.com\",\n    },\n  ])\n);\n```\n\n2. Copy this code into the Console of your borwser and execute it\n3. Copy the output (your auth string) into the `config.php`\n\n**Make sure to enable \"login from insecure apps\" if having any issues connecting**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrivo25%2Fgoogle-alerts-api-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrivo25%2Fgoogle-alerts-api-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrivo25%2Fgoogle-alerts-api-php/lists"}