<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sp2hari@weblog... &#187; google</title>
	<atom:link href="http://sp2hari.com/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://sp2hari.com</link>
	<description>I see, learn and rediscover... everyday!</description>
	<lastBuildDate>Thu, 24 Nov 2011 22:06:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Importing Contacts from Google Mail using OAuth</title>
		<link>http://sp2hari.com/2010/05/28/importing-contacts-from-google-mail-using-oauth/</link>
		<comments>http://sp2hari.com/2010/05/28/importing-contacts-from-google-mail-using-oauth/#comments</comments>
		<pubDate>Fri, 28 May 2010 21:43:40 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[interviewstreet-dev]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=544</guid>
		<description><![CDATA[This is my second post in the fetch contacts from email account series. In this post, we are going to fetch contacts from a Google account. This isn&#8217;t a detailed tutorial, but a quick 2 minute how-to. $this-&#62;config-&#62;item(&#8216;google_return_url&#8217;) is the &#8230; <a href="http://sp2hari.com/2010/05/28/importing-contacts-from-google-mail-using-oauth/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is my second post in the fetch contacts from email account series. In this post, we are going to fetch contacts from a Google account. This isn&#8217;t a detailed tutorial, but a quick 2 minute how-to.</p>
<p>$this-&gt;config-&gt;item(&#8216;google_return_url&#8217;) is the url of the page to which user is returned after a login attempt.</p>
<p>1. Add the following code where the user has to select Google Mail to import contacts.</p>
<p><code>&lt;a href="https://www.google.com/accounts/AuthSubRequest?next=&lt;?php echo $this-&gt;config-&gt;item('google_return_url').'?data=abc'; ?&gt;&#038;scope=http://www.google.com/m8/feeds/contacts/default/thin&#038;secure=0&#038;session=1"&gt;Fetch Google Contacts&lt;/a&gt;</code></p>
<p>2. Include these 2 functions in your PHP code.<br />
<code>function make_api_call($url, $token)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$ch = curl_init();<br />
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_URL, $url);<br />
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;$curlheader[0] = sprintf("Authorization: AuthSub token=\"%s\"/n", $token);<br />
&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($ch, CURLOPT_HTTPHEADER, $curlheader);<br />
&nbsp;&nbsp;&nbsp;&nbsp;$output = curl_exec($ch);<br />
&nbsp;&nbsp;&nbsp;&nbsp;curl_close($ch);<br />
&nbsp;&nbsp;&nbsp;&nbsp;return $output;<br />
}<br />
&nbsp;<br />
function get_session_token($onetimetoken)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$output = make_api_call("https://www.google.com/accounts/AuthSubSessionToken", $onetimetoken);<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (preg_match("/Token=(.*)/", $output, $matches))<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sessiontoken = $matches[1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "Error authenticating with Google.";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return $sessiontoken;<br />
}</code><br />
3. Add the following code to the return url file.</p>
<p><code>$sessiontoken = get_session_token($_GET['token']);<br />
$contacts = make_api_call("http://www.google.com/m8/feeds/contacts/default/thin?alt=json&#038;max-results=1000", $sessiontoken);<br />
$contacts = json_decode($contacts, TRUE);<br />
foreach ($contacts['feed']['entry'] as $contact)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$emails[] = $contact['gd$email'][0]['address'];<br />
}<br />
//$emails array has the email addresses of all the contacts.</code><br />
4. That&#8217;s it folks. It is that simple.</p>
<p>Further reading :<br />
1. <a href="http://code.google.com/apis/contacts/">http://code.google.com/apis/contacts/</a><br />
2. <a href="http://code.google.com/apis/contacts/docs/3.0/reference.html">http://code.google.com/apis/contacts/docs/3.0/reference.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2010/05/28/importing-contacts-from-google-mail-using-oauth/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Image Search</title>
		<link>http://sp2hari.com/2008/03/22/google-image-search/</link>
		<comments>http://sp2hari.com/2008/03/22/google-image-search/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 07:12:52 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/03/22/google-image-search/</guid>
		<description><![CDATA[I don&#8217;t remember who exactly gave me this script. Must be either Verma or Manas, but this one is so cool. The code looks pretty easy and clear, though I didn&#8217;t try to understand it completely. So this is what &#8230; <a href="http://sp2hari.com/2008/03/22/google-image-search/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t remember who exactly gave me this script. Must be either Verma or Manas, but this one is so cool.<br />
The code looks pretty easy and clear,  though I didn&#8217;t try to understand it completely.<br />
So this is what you have to do. </p>
<p>Open Google image search and search for some image. If you are lazy to do that, click<br />
<a href="http://images.google.com/images?hl=en&#038;q=sp2hari&#038;btnG=Search+Images&#038;gbv=2">http://images.google.com/images?hl=en&#038;q=sp2hari&#038;btnG=Search+Images&#038;gbv=2</a></p>
<p>Then copy this javascript code and paste it in the URL bar<br />
<code>javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images; DIL=DI.length; function A(){for(i=0; i&lt;DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0)</code></p>
<p>Cool right? ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/03/22/google-image-search/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Topping google search</title>
		<link>http://sp2hari.com/2007/06/11/topping-google-search/</link>
		<comments>http://sp2hari.com/2007/06/11/topping-google-search/#comments</comments>
		<pubDate>Mon, 11 Jun 2007 19:24:00 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[podworks]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=52</guid>
		<description><![CDATA[I attended the podworks.in last weekend. For those who don&#8217;t know what podworks is , PodWorks.in is a 2-day workshop styled unconference dedicated to the sharing of knowledge around audio and video podcasting. It&#8217;s a successor to the extremely successful &#8230; <a href="http://sp2hari.com/2007/06/11/topping-google-search/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I attended the <span style="font-style: italic;">podworks.in</span> last weekend. For those who don&#8217;t know what podworks is , <a href="http://www.podworks.in/">PodWorks.in</a> is a 2-day workshop styled unconference dedicated to the sharing of knowledge around audio and video podcasting. It&#8217;s a successor to the extremely successful BlogCamp that was held last year.</p>
<p>Though i have lots and lots to say about the event, one strange and nice thing is that if you <a href="http://www.google.co.in/search?hl=en&#038;q=podworks.in&amp;btnG=Google+Search&#038;meta=">google for podworks.in</a> my blog tops the list :-) :-)</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_7owHVJdIzX8/Rm2lK7ijUYI/AAAAAAAAA6k/sFwDgK3P-ww/s1600-h/Screenshot.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_7owHVJdIzX8/Rm2lK7ijUYI/AAAAAAAAA6k/sFwDgK3P-ww/s320/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5074893962316304770" border="0"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2007/06/11/topping-google-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

