*/ require_once 'googleplus.class.php'; @date_default_timezone_set('GMT'); $oGooglePlus = new GooglePlus('https://plus.google.com/111291152590065605567/posts'); if ($oGooglePlus->isReady) { $writer = new XMLWriter(); $writer->openURI('php://output'); $writer->startDocument('1.0', 'UTF-8'); $writer->setIndent(true); // declarer for rss element $writer->startElement('rss'); $writer->writeAttribute('version', '2.0'); $writer->writeAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); // start element channel $writer->startElement('channel'); $writer->writeElement('title', 'Google+ profile of ' . $oGooglePlus->get('name')); $writer->writeElement('description', strip_tags($oGooglePlus->get('introduction'))); $writer->writeElement('link', $oGooglePlus->get('url')); $writer->writeElement('pubDate', date('D, d M Y H:i:s e')); $writer->endElement(); // end element channel if ($oGooglePlus->get('plainposts') != 'n/A') { foreach ($oGooglePlus->get('plainposts') as $arrLink) { $writer->startElement('item'); $writer->writeElement('title', GooglePlus::getShortText($arrLink[0], 120, true)); $writer->writeElement('description', $arrLink[0]); if ($arrLink[1]) { $writer->writeElement('link', $arrLink[1]); $writer->writeElement('guid', $item['guid'] = $arrLink[1]); } $writer->endElement();
} hr { clear:both; margin:20px 0; } </style> <link rel="alternate" type="application/rss+xml" title="G+ Posts RSS 2.0" href="feed.php" /> </head> <body> <?php require_once 'googleplus.class.php'; $arrTests = array('https://plus.google.com/117918784076966584831/posts', 'https://plus.google.com/107117483540235115863/posts', 'https://plus.google.com/106189723444098348646/posts', 'https://plus.google.com/111091089527727420853/posts', '109813896768294978296', '109412257237874861202'); foreach ($arrTests as $strTest) { $oGooglePlus = new GooglePlus($strTest); if ($oGooglePlus->isReady) { echo '<h1>Parsing Google+ profile of “' . $oGooglePlus->get('name') . '”</h1>'; if (($strDesc = $oGooglePlus->get('description')) && $strDesc != 'n/A') { echo '<h2>' . $strDesc . '</h2>'; } echo '<p><img src="' . $oGooglePlus->get('image') . '" width="100" height="100" alt="Profile Image" style="float:right;"></p>'; echo '<p><b>Google+ id:</b> ' . $oGooglePlus->get('id') . '</p>'; echo '<p><b>Google+ profile url:</b> <a href="' . $oGooglePlus->get('url') . '">' . $oGooglePlus->get('url') . '</a></p>'; echo '<p><b>First name:</b> ' . $oGooglePlus->get('firstname') . ' <b>Last name:</b> ' . $oGooglePlus->get('lastname') . ' <b>Nickname:</b> ' . $oGooglePlus->get('nickname') . ' <b>Other names:</b> ' . $oGooglePlus->get('othernames') . '</p>'; echo '<p><b>Occupation:</b> ' . $oGooglePlus->get('occupation') . '</p>'; echo '<p><b>Introduction:</b> ' . $oGooglePlus->get('introduction') . '</p>'; echo '<p><b>Links:</b> '; if ($oGooglePlus->get('links') == 'n/A') { echo 'n/A'; } else { foreach ($oGooglePlus->get('links') as $arrLink) { echo '<a href="' . $arrLink[1] . '">' . $arrLink[0] . '</a> ';
* GooglePlus Feed RSS 2.0 * * @author Frank Bueltge <*****@*****.**> * @copyright 2011 -- Frank Bueltge * @license Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany * (http://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en) * @link http://bueltge.de * @version 1.1 * @date 10.07.2011 20:11:01 */ require_once 'rss2.class.php'; require_once 'googleplus.class.php'; $oGooglePlus = new GooglePlus('https://plus.google.com/111291152590065605567/posts'); if ($oGooglePlus->isReady) { $channel = array(); $channel['title'] = 'Google+ profile of ' . $oGooglePlus->get('name'); $channel['description'] = strip_tags($oGooglePlus->get('introduction')); $channel['link'] = $oGooglePlus->get('url'); $w = new Rss('php://output', $channel['title'], $channel['description'], $channel['link'], date('Y-m-d')); if ($oGooglePlus->get('plainposts') != 'n/A') { foreach ($oGooglePlus->get('plainposts') as $arrLink) { $item = array(); $item['title'] = GooglePlus::getShortText($arrLink[0], 120, true); if ($arrLink[1]) { $item['link'] = $arrLink[1]; $item['guid'] = $arrLink[1]; } $item['description'] = $arrLink[0]; $w->add_item($item); } }