<?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>Pixels from the Edge &#187; Twitter API</title>
	<atom:link href="http://pixelsfromtheedge.com/tag/twitter-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelsfromtheedge.com</link>
	<description>Creative // Technology // Digital // Interactive // Mobile // Advertising</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:18:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Disabling your Twitter background image cleanly</title>
		<link>http://pixelsfromtheedge.com/2009/03/disabling-your-twitter-background-image/</link>
		<comments>http://pixelsfromtheedge.com/2009/03/disabling-your-twitter-background-image/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 15:46:00 +0000</pubDate>
		<dc:creator>Richie</dc:creator>
				<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter API]]></category>

		<guid isPermaLink="false">http://www.detroitdigitalrevolution.com/clients/me/blog/?p=17</guid>
		<description><![CDATA[Something that's frustrating me with the Twitter API is that there seems to be a useful piece of information missing when querying the API for a users settings.  There's a few different ways of pulling this info but <a href="http://twitter.com/users/show/ldnstreetlife.xml" target="_new">http://twitter.com/users/show/ldnstreetlife.xml</a> is as good as any for the purpose of showing you what I'm talking about.  The feed contains all the users profile information so we can quite nicely replicate their design in our own app except one vital piece - there is no mention of whether or not the background-image has been disabled.]]></description>
			<content:encoded><![CDATA[<p>Something that&#8217;s frustrating me with the Twitter API is that there seems to be a useful piece of information missing when querying the API for a users settings.  There&#8217;s a few different ways of pulling this info but <a href="http://twitter.com/users/show/ldnstreetlife.xml" target="_new">http://twitter.com/users/show/ldnstreetlife.xml</a> is as good as any for the purpose of showing you what I&#8217;m talking about.  The feed contains all the users profile information so we can quite nicely replicate their design in our own app except one vital piece &#8211; there is no mention of whether or not the background-image has been disabled.  Yes the &#8220;profile_background_image_url&#8221; node contains the url to the image and the &#8220;profile_background_tile&#8221; is a boolean which tells us whether or not to tile that background image, but there is also a third option offered in the Twitter design settings which is to disable the background-image altogether, and the API fails to report on this. The problem is it can really make the design look crappy on an account with the background image disabled:</p>
<p><img src="http://www.pixelsfromtheedge.com/wp-content/uploads/2009/03/badtwitterfriendsbgexample.jpg" alt="" title="badtwitterfriendsbgexample" width="400" height="241" class="aligncenter size-full wp-image-1790" /></p>
<p>It&#8217;s a simple oversight by the API team and one that I&#8217;m sure is a dead simple fix when they get around to addressing it.  I tried hitting up a couple of the Twitter API coders directly on Twitter with no luck, so I just recently submitted it as a bug <a href="http://code.google.com/p/twitter-api/issues/detail?id=370" target="_new">http://code.google.com/p/twitter-api/issues/detail?id=370</a>.</p>
<p>In the mean time I wanted to come up with a way to address this issue in my app.  More than anything I myself have the background-image disabled in my settings so when I look up myself in my own app it&#8217;s ugly.  The obvious simple solution was to throw in an exception for myself, but that doesn&#8217;t really fly with me.</p>
<p>The second idea I had was something way more complicated. Firstly I&#8217;d need to copy over the twelve theme settings into my app.  Then I&#8217;d be able to cross-reference the users background image with their background color to see if they were using a default image with a custom color.  If that were the case it would mean the user had personalized their background color but not their background image, and therefore it was highly likely that the background image had been disabled.  At first this seemed like quite a clever idea, it certainly worked in my case where I had disabled my background image and personalized my background color but my background image still remained as one of the default themes.  But what if a user had at one point uploaded their own image and then decided to disable it?  In that scenario their disabled background image would still be displayed.  And then there&#8217;s the perhaps more unlikely, but still possible situation where a user has kept the default background image enabled but changed the background color.  In that scenario the background image would wrongly not display in my app.</p>
<p>Third time lucky was the obvious, and the one that I settled on as a viable solution while we wait on the API team to amend the feed.  It&#8217;s basically just to upload an invisible image as your background image in the Twitter display setting &#8211; an invisible image being either a transparent gif/png or an image matching your background color (which would obviously be harder to maintain in the long run).  I created a 1px x 1px transparent gif and it worked great:</p>
<p><img src="http://www.pixelsfromtheedge.com/wp-content/uploads/2009/03/badtwitterfriendsbgexample2.jpg" alt="" title="badtwitterfriendsbgexample2" width="400" height="241" class="aligncenter size-full wp-image-1792" /></p>
<p>It&#8217;s not an across the board solution, it only works if each individual user takes a moment to update the background image in their settings. But for the time being it works great for me, it no longer looks like my page is broke in my own app, and I&#8217;m sure the Twitter API team will have this issue resolved in no time.  If you also have your background image disabled in your Twitter profile go ahead and re-use my image so you don&#8217;t run into the same problem: <a href="http://s3.amazonaws.com/twitter_production/profile_background_images/6355571/transparent.gif">http://s3.amazonaws.com/twitter_production/profile_background_images/6355571/transparent.gif</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pixelsfromtheedge.com/2009/03/disabling-your-twitter-background-image/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Whitelisted by the Twitter API</title>
		<link>http://pixelsfromtheedge.com/2009/03/whitelisted-by-twitter-api/</link>
		<comments>http://pixelsfromtheedge.com/2009/03/whitelisted-by-twitter-api/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 16:29:00 +0000</pubDate>
		<dc:creator>Richie</dc:creator>
				<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter API]]></category>

		<guid isPermaLink="false">http://www.detroitdigitalrevolution.com/clients/me/blog/?p=16</guid>
		<description><![CDATA[This was a very exciting discovery I made yesterday.  I was on the <a href="http://apiwiki.twitter.com/FAQ" target="_new">Twitter API FAQ</a> looking for exact numbers for the query rate limit when I noticed the following entry:
<i>I keep hitting the rate limit. How do I get more requests per hour?</i>
Just fill out <a href="http://twitter.com/help/request_whitelisting" target="_new">this other handy form</a>! Note that you <strong>must</strong> have a Twitter account and <strong>must be signed in as the account you want the rate limits raised for</strong>. Please also note that we <strong>only&#8230;</strong> approve developers for the whitelist.
It may take up to 72 hours for us to get back]]></description>
			<content:encoded><![CDATA[<p>This was a very exciting discovery I made yesterday.  I was on the <a href="http://apiwiki.twitter.com/FAQ" target="_new">Twitter API FAQ</a> looking for exact numbers for the query rate limit when I noticed the following entry:</p>
<p><i>I keep hitting the rate limit. How do I get more requests per hour?</i></p>
<p>Just fill out <a href="http://twitter.com/help/request_whitelisting" target="_new">this other handy form</a>! Note that you <strong>must</strong> have a Twitter account and <strong>must be signed in as the account you want the rate limits raised for</strong>. Please also note that we <strong>only</strong> approve developers for the whitelist.</p>
<p>It may take up to 72 hours for us to get back to you, but we try to respond to requests as fast as possible barring holidays and disasters. Once you&#8217;re on the whitelist you&#8217;ll be able to make up to 20,000 requests per hour. Use them wisely!</p>
<p>That&#8217;s weird, I&#8217;d spent the whole weekend reading the API and I&#8217;d never noticed that.  Is it possible they&#8217;ve just opened it up to the public?  Whereas before we had to jump through a couple more hoops to get whitelisted?  Seems likely as they slipped in opening up <a href="http://apiwiki.twitter.com/OAuth-FAQ" target="_new">OAuth beta</a> to the public on Monday without really making a big fuss about it.</p>
<p>Anyways within the hour I received an email from Twitter approving my request, and it was only a few hours later that my username was whitelisted, and now a day later I can see my IP addresses are too.  And now I can make 20,000 API calls an hour!  Or more even, I&#8217;m not sure, as the email response I got actually states &#8220;You should find any rate limits no longer apply to authenticated requests&#8221;.</p>
<p>And all just in time too.  @<a href="http://twitter.com/keithelder" target="_new">keithelder</a> (who I wrongly never gave credit for coming up with the domain name &#8211; sorry Keith I didn&#8217;t think you wanted your good name attached to a bad joke!) tweeted about <a href="http://www.badtwitterfriends.com/">www.BadTwitterFriends.com</a> and sent a fair number of users its way, which would&#8217;ve used up the default 100 queries an hour within minutes and made for a really lame experience.  @<a href="http://twitter.com/olivers" target="_new">olivers</a> even <a href="http://www.sturmnet.org/blog/2009/03/20/bad-twitter-friends" target="_new">blogged about it</a>, thanks dude I&#8217;m glad some people know how to take a joke (some people have reacted to the site by questioning its Twitter ethics LOL!).  So now the flood gates are open maybe I can really do some damage with this thing, take it from being a bad joke to something that is genuinely useful.  Or not.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelsfromtheedge.com/2009/03/whitelisted-by-twitter-api/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mashing up the Twitter API with PHP</title>
		<link>http://pixelsfromtheedge.com/2009/03/mashing-up-twitter-api-with-php/</link>
		<comments>http://pixelsfromtheedge.com/2009/03/mashing-up-twitter-api-with-php/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 23:44:00 +0000</pubDate>
		<dc:creator>Richie</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter API]]></category>

		<guid isPermaLink="false">http://www.detroitdigitalrevolution.com/clients/me/blog/?p=12</guid>
		<description><![CDATA[<pre class="brush: php;">&#60;?php
$username = "youraccountname";
$password = "yourpassword";
$url="http://twitter.com/statuses/friends/londonstreetlif.xml";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_URL, $url);
$result = curl_exec ($curl); //remove space before parenthesis
curl_close($curl);
?&#62;
</pre>]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">&lt;?php
$username = "youraccountname";
$password = "yourpassword";
$url="http://twitter.com/statuses/friends/londonstreetlif.xml";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_URL, $url);
$result = curl_exec ($curl); //remove space before parenthesis
curl_close($curl);
?&gt;
</pre>
<p>Now lets use SimpleXML to loop through the returned xml and create an array of my friends:</p>
<pre class="brush: php;">&lt;?php
$friendsArr=array();
$feed = simplexml_load_string($result);
foreach($feed-&gt;user AS $userXML){
   $user = simplexml_import_dom($userXML);
   $friendsArr[]=(string)$user-&gt;screen_name;
}
?&gt;
</pre>
<p>Lets assume we have done the same thing to create an array of my followers, now we can find everyone that I am friends with but doesn&#8217;t follow me:</p>
<pre class="brush: php;">&lt;?php
$badfriendsArr=array_diff($friendsArr,$followersArr);
?&gt;
</pre>
<p>And finally lets display, the lists are returned from Twitter in the order the relationship began from newest to oldest, so lets order alphabetically and print:</p>
<pre class="brush: php;">&lt;?php
natcasesort($badfriendsArr);
foreach($badfriendsArr AS $badfriend){
   echo "&lt;a href="http://www.twitter.com/$badfriend"&gt;$badfriend&lt;/a&gt;&lt;br&gt;";
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pixelsfromtheedge.com/2009/03/mashing-up-twitter-api-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

