Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Example Interest Rates: Home Loan Variable: 1.89% (1.9%*) • Home Loan Fixed: 1.84% (2.11%*) • Fixed: 1.84% (2.11%*) • Variable: 1.89% (1.9%*) • Investment IO: 2.05% (4.36%*) • Investment PI: 1.58% (2.72%*)

Gmail RSS Feed with PHP

This cool PHP function will create an RSS feed from the email in your Gmail inbox. It's a good way of including your mail with all the other content you aggregate in your RSS reader. I haven't tried it in a while so no longer sure if it still works.

1
<?php 
2
/*
3
 Gmail RSS Feed with PHP
4
 http://www.beliefmedia.com/code/php-snippets/gmail-rss-feed
5
*/
6
 
7
function beliefmedia_gmail_rss_feed($username, $password) {
8
 $url = "https://mail.google.com/mail/feed/atom";
9
 
10
  $curl = curl_init();
11
  curl_setopt($curl, CURLOPT_URL, $url);
12
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
13
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
14
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
15
  curl_setopt($curl, CURLOPT_USERPWD, $username . ":" . $password);
16
  curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
17
  curl_setopt($curl, CURLOPT_ENCODING, "");
18
  $gmail_data = curl_exec($curl);
19
  curl_close($curl);
20
 
21
 return $gmail_data;
22
}
23
 
24
header('Content-Type:text/xml; charset=UTF-8');
25
echo beliefmedia_gmail_rss_feed('YourUsername@gmail.com', 'Password');

Take appropriate measures to ensure security.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Washington)

  Want to have a chat?
 

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment