<?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>Joseph Tinsley &#187; cuRL</title>
	<atom:link href="http://www.josephtinsley.com/tag/curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.josephtinsley.com</link>
	<description>Trying to build applications that I think are useful</description>
	<lastBuildDate>Thu, 11 Aug 2011 03:36:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Google Favicon API, PHP Code</title>
		<link>http://www.josephtinsley.com/2009/11/10/google-favicon-api-php-code/</link>
		<comments>http://www.josephtinsley.com/2009/11/10/google-favicon-api-php-code/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 05:00:00 +0000</pubDate>
		<dc:creator>Joseph</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[cuRL]]></category>
		<category><![CDATA[Favicon]]></category>
		<category><![CDATA[PHP Code]]></category>

		<guid isPermaLink="false">http://www.josephtinsley.com/39/2009-11-10/google-favicon-api-php-code/</guid>
		<description><![CDATA[I ran into something very, very interesting today. Google Favicon API (A Favorite Icon API). It&#8217;s an API that allows you to pull websites Favicons, plus the API dynamically converts the image into a PNG format. This actually comes at a great time because I was just thinking the other day that since I have [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into something very, very interesting today. <strong>Google Favicon API</strong><em> <br />(A Favorite Icon API)</em>. It&#8217;s an API that allows you to pull websites Favicons, plus the API dynamically converts the image into a PNG format. This actually comes at a great time because I was just thinking the other day that since I have the option to add offsite URL&rsquo;s to my site now. Would&#8217;nt it would be supa cool if I could also included their Favicon? To beak it down if you look into my site&rsquo;s right side navigation you will see the &#8220;Links&#8221; category. Well I thought it would be nice, I mean supa cool if I had a script that could automatically include the corresponding sites Favicons.&nbsp; And BAM! Thanks Google Favicon API. I wrapped this APIs up with some cURL and a little PHP and now I have a working PHP function. I don&rsquo;t know much about the Google Favicon API but it looks like it&rsquo;s been around for about a year. So it&rsquo;s a good chance that this API could suddenly up and move or disappear all togehter. Basically what I&rsquo;m saying is I don&#8217;t know how long the good times will last. So in my opinion I suggest you consider the use of this script temporary until you can get the time to build a much reliable one yourself.</p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?PHP</span><br />
<span style="color: #000000; font-weight: bold;">function</span> getFavicon<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$filName</span><span style="color: #339933;">=</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'folder/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$filName</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w+'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.google.com/s2/favicons?domain='</span><span style="color: #339933;">.</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FILE<span style="color: #339933;">,</span> <span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$var</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'techcrunch.com'</span><span style="color: #339933;">;</span><br />
getFavicon<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.josephtinsley.com/2009/11/10/google-favicon-api-php-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

