<?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>140dev &#187; Phirehose</title>
	<atom:link href="http://140dev.com/twitter-api-programming-blog/category/phirehose/feed/" rel="self" type="application/rss+xml" />
	<link>http://140dev.com</link>
	<description>Twitter API Programming Tips, Tutorials, Source Code Libraries and Consulting</description>
	<lastBuildDate>Wed, 31 Jul 2019 10:03:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>140dev streaming API framework upgrade is required for the Phirehose library</title>
		<link>http://140dev.com/twitter-api-programming-blog/140dev-streaming-api-framework-upgrade-is-required-for-the-phirehose-library/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/140dev-streaming-api-framework-upgrade-is-required-for-the-phirehose-library/#comments</comments>
		<pubDate>Wed, 23 Apr 2014 10:44:52 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[140dev Source Code]]></category>
		<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Phirehose]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=3032</guid>
		<description><![CDATA[The streaming API changed its behavior on April 22, breaking all the copies of the Phirehose library I have in use with my 140dev streaming API framework. Thankfully, a patched version of Phirehose was posted within a few hours. If you are running any copies of the 140dev framework, you need to replace your current [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>The streaming API changed its behavior on April 22, breaking all the copies of the Phirehose library I have in use with my 140dev streaming API framework. Thankfully, a patched version of Phirehose was posted within a few hours. If you are running any copies of the 140dev framework, you need to replace your current copy of Phirehose.php with the <a href="https://github.com/fennb/phirehose/blob/master/lib/Phirehose.php">latest patched version</a>. If you are running the framework code, you will find your current copy of Phirehose.php in the /libraries/phirehose folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/140dev-streaming-api-framework-upgrade-is-required-for-the-phirehose-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The full streaming API stack</title>
		<link>http://140dev.com/twitter-api-programming-blog/the-full-streaming-api-stack/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/the-full-streaming-api-stack/#comments</comments>
		<pubDate>Wed, 29 Jan 2014 16:07:47 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[140dev Source Code]]></category>
		<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Server configuration]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[tmhOAuth]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=2747</guid>
		<description><![CDATA[I&#8217;ve been spending the last few days helping people install the latest version of the streaming API framework. This has reminded me of how many moving parts there are, and how this can get in the way of building a mental model of what is actually going on. One of the biggest confusions seems to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;ve been spending the last few days helping people install the latest version of the <a href="http://140dev.com/free-twitter-api-source-code-library/">streaming API framework</a>. This has reminded me of how many moving parts there are, and how this can get in the way of building a mental model of what is actually going on. One of the biggest confusions seems to be the idea that I wrote Twitter&#8217;s streaming API. Actually, all I&#8217;ve done is put a thin layer of code on top of a very deep stack. That code may tie things together, but there are many levels of code that need to be installed and configured. Let&#8217;s work our way up from the basic server level:</p>
<p>- <strong>Operating system</strong>. The streaming API code will run on *nix variants, Windows, and Mac OS X machines. Windows has it own unique quirks, but if you are willing to run a Windows machine as a Web server, you have already discovered that.<br />
- <strong>Apache</strong> must be installed and configured to run PHP. You should also configure Apache to run PHP within HTML pages. This is not always set by default.<br />
- <strong>PHP</strong> runs within Apache. You will need version 5.2 or greater. I&#8217;ve recently seen problems on Windows servers unless 5.2.17 or greater of PHP is installed.<br />
- <strong>cURL</strong> is a library that runs within PHP and allows connections to remote servers, such as the Twitter API. You won&#8217;t need to call cURL directly in your code, but it is used by the Phirehose and tmhOAuth libraries. cURL should be enabled by default, but some webhosts turn it off.<br />
- <strong>MySQL</strong>. I try to use version 5.0 or greater.<br />
- The <a href="http://140dev.com/free-twitter-api-source-code-library/twitter-database-server/db-lib-php/">db_lib.php</a> code in the framework uses the <strong>mysqli</strong> PHP library to communicate with MySQL, so that must be installed within PHP.<br />
- <strong>Phirehose</strong> is the library that makes the actual connection to the streaming API in <a href="http://140dev.com/free-twitter-api-source-code-library/twitter-database-server/get-tweets-php/">get_tweets.php</a>. I didn&#8217;t write this, but the author, Fenn Bailey allows me to include it in the framework&#8217;s source code. It lives <a href="https://github.com/fennb/phirehose/tree/master/lib">here</a>.<br />
- <strong>tmhOAuth</strong> is a library that lets you make OAuth calls to Twitter&#8217;s REST API, such as searching and reading timelines. It isn&#8217;t used by the streaming API framework, but is part of my engagement programming code, and many sample scripts on this site, so I&#8217;m including it here, It is written by Matt Harris and <a href="https://github.com/themattharris/tmhOAuth">lives here</a>.<br />
- Finally we get to my streaming API framework code, which rests on all this work by thousands of other people. Open source is an amazing thing, but finding the right path to an app isn&#8217;t easy at first. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/the-full-streaming-api-stack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade Phirehose now for continued streaming API access</title>
		<link>http://140dev.com/twitter-api-programming-blog/upgrade-phirehose-now-for-continued-streaming-api-access/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/upgrade-phirehose-now-for-continued-streaming-api-access/#comments</comments>
		<pubDate>Sun, 29 Dec 2013 21:21:14 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Streaming API]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=2646</guid>
		<description><![CDATA[Twitter is upgrading the streaming API on January, 6th to require http 1.1 connections. This will break the Phirehose library that manages the API connection in my 140dev streaming API framework. If you&#8217;re running this framework code, it&#8217;s essential that you replace your copy of Phirehose in the next week or tweet collection will stop. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>Twitter is upgrading the streaming API on January, 6th to require http 1.1 connections. This will break the Phirehose library that manages the API connection in my 140dev streaming API framework. If you&#8217;re running this framework code, it&#8217;s essential that you replace your copy of Phirehose in the next week or tweet collection will stop. </p>
<p>Luckily it&#8217;s a really easy upgrade:<br />
1. Download the new Phirehose files. You can get them from the <a href="https://github.com/fennb/phirehose/tree/master/lib">Github repository</a>, or download them from <a href="http://140dev.com/download/phirehose_upgrade.zip">my site</a>.<br />
2. Replace your copy of Phirehose.php and OauthPhirehose.php with the new versions. You&#8217;ll find the existing files in /140dev/libraries/phirehose.<br />
3. Kill the running copy of get_tweets.php.<br />
4. Restart get_tweets.php in the background with: nohup php get_tweets.php > /dev/null &#038;</p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/upgrade-phirehose-now-for-continued-streaming-api-access/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Phirehose library needs some beta testers</title>
		<link>http://140dev.com/twitter-api-programming-blog/the-phirehose-library-needs-some-beta-testers/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/the-phirehose-library-needs-some-beta-testers/#comments</comments>
		<pubDate>Thu, 05 Dec 2013 18:10:31 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Streaming API]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=2622</guid>
		<description><![CDATA[I&#8217;m not the author of the Phirehose library for streaming API connections. I just use it as the network layer of my streaming API code. I don&#8217;t have the network coding skills to write this library&#8217;s code or to fix it, but I can encourage anyone using Phirehose or my 140dev Twitter framework code to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;m not the author of the <a href="https://github.com/fennb/phirehose">Phirehose library</a> for streaming API connections. I just use it as the network layer of my <a href="http://140dev.com/free-twitter-api-source-code-library/">streaming API code</a>. I don&#8217;t have the network coding skills to write this library&#8217;s code or to fix it, but I can encourage anyone using Phirehose or my 140dev Twitter framework code to test the <a href="https://groups.google.com/forum/#!topic/phirehose-users/0LRxAw4Qni8">new version</a> of this library. On January 6th, Twitter plans on switching from http 1.0 to 1.1 for the streaming API. I know what that means conceptually. The http header exchange and error code allow a client and server to talk to each other. That is the depth of my technical knowledge here. The result, if this isn&#8217;t fixed in time, is that my streaming API code and anything else using Phirehose will stop running. </p>
<p>The good thing is that once Phirehose is patched for this change, all you have to do is download a new version of the library into your app&#8217;s directory. Nothing in your code should change. <a href="http://dcook.org/work/">Darren Cook</a> has now written this <a href="https://groups.google.com/forum/#!topic/phirehose-users/0LRxAw4Qni8">Phirehose http 1.1 patch</a> and needs people to help test it. Please add your findings to this <a href="https://groups.google.com/forum/#!topic/phirehose-users/0LRxAw4Qni8">thread</a> on the forum. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/the-phirehose-library-needs-some-beta-testers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New SSL Certificates are not a problem for anyone using the 140dev code</title>
		<link>http://140dev.com/twitter-api-programming-blog/new-ssl-certificates-are-not-an-problem-for-anyone-using-the-140dev-code/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/new-ssl-certificates-are-not-an-problem-for-anyone-using-the-140dev-code/#comments</comments>
		<pubDate>Wed, 20 Nov 2013 01:49:04 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Twitter OAuth]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=2461</guid>
		<description><![CDATA[Twitter posted a notice today about the need for new SSL certificates: At the end of 2013, all Browsers and Certificate Authorities will no longer support 1024 bits RSA certificates to be compliant to National Institute of Standards and Technology (NIST) guidelines [1]. The SSL certificate currently used on api.twitter.com is signed with the older [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>Twitter posted a <a href="https://dev.twitter.com/blog/rest-api-ssl-certificate-updates">notice</a> today about the need for new SSL certificates:</p>
<blockquote><p>At the end of 2013, all Browsers and Certificate Authorities will no longer support 1024 bits RSA certificates to be compliant to National Institute of Standards and Technology (NIST) guidelines [1].</p>
<p>The SSL certificate currently used on api.twitter.com is signed with the older Verisign G2 root CA certificate.</p>
<p>Due to NIST guidelines, api.twitter.com will change to a new certificate on Dec 10th, 2013. The new certificate will be signed with VeriSign Class 3 Secure Server CA &#8211; G3, which has the 2048 bits key length needed to meet recommended security levels.</p>
<p>This means that all HTTP clients used by your application must trust the new root certificate, otherwise you won&#8217;t be able to connect in the API. To ensure proper SSL certificate verification across all of Twitter&#8217;s services, your software should include all Verisign Root Certificates in its CAFile or other respective keystore. The root certificates are available at the following link:<br />
* Verisign (https://www.symantec.com/page.jsp?id=roots)
</p></blockquote>
<p>I have to admit here that I don&#8217;t really know what an SSL certificate is. I know that it is a file that allows SSL to work, but beyond that my perception of this announcement was like Bart Simpson&#8217;s dog:</p>
<blockquote><p>Blah blah blah Dec 10th blah blah everything breaks blah blah.
</p></blockquote>
<p>What I could tell was that I might need to download something and warn everyone using my code to do the same. So I immediately sent queries to the authors of Phirehose and tmhOAuth, the two libraries upon which all my Twitter code depends. The responses were that we are all good, and I could just ignore this cryptic, yet frightening warning.  </p>
<p>Fenn Bailey, author of Phirehose, replied:</p>
<blockquote><p>Phirehose has no visibility of SSL itself but simply uses PHP (and your OS&#8217;s) SSL layer. Basically, if PHP will work with these new certificates, Phirehose will.</p></blockquote>
<p>And Matt Harris, author of tmhOAuth, said:</p>
<blockquote><p>If you use the included cacert.pem you&#8217;ll be using the same SSL CA roots that Mozilla uses as of Sat Dec 29 20:03:40 2012 (the latest version) &#8212; so things should be fine.</p></blockquote>
<p>Hooray! Everything is good. Nothing to worry about. If you were as mystified as me by the SSL certificate announcement, you can relax. </p>
<p>On a personal level, this lack of understanding of the layers beneath the code that I produce is like the perception of other scientific disciplines when I was in college. I was an organic chemistry major, and we used to laugh at the molecular biology majors, because they didn&#8217;t have good enough memories to hack Organic Chem. The physical chemists used to laugh at us, because we couldn&#8217;t handle the math to understand Pchem. The physicists laughed at the physical chemists, because they couldn&#8217;t base all their work on Quantum Theory. Who knows what the mathematicians thought of the physicists. </p>
<p>Modern Web development has so many moving parts and layers in its software stack that you just have to trust that the guys building the parts your code rests on know what they are doing. I just wish that the Twitter folks understood that many of their 3rd party devs are not CS majors, and yet we are able to build lots of cool apps. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/new-ssl-certificates-are-not-an-problem-for-anyone-using-the-140dev-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic restarting of stream connection</title>
		<link>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 03:30:33 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1181</guid>
		<description><![CDATA[The 2012 candidate system is going to need a more fault tolerant collection system. Since the Egyptian protest started Twitter has been even more unreliable, and this is affecting the connection to the streaming API. I use a monitoring system to warn me when tweet collection has stopped, but it hasn&#8217;t been necessary in the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>The 2012 candidate system is going to need a more fault tolerant collection system. Since the Egyptian protest started Twitter has been even more unreliable, and this is affecting the connection to the streaming API. I use a monitoring system to warn me when tweet collection has stopped, but it hasn&#8217;t been necessary in the past to automatically restart the connection. I saw some communication about this on the Phirehose mailing list. I need to run the collection script and capture the process id. Then kill the process with the same id and restart it when no new tweets are received for 10 minutes. </p>
<p>Update: This was pretty easy. I can add this code to the collection script to have it write it&#8217;s process id to a text file when it starts:<br />
<code>$fp = fopen('process_id.txt','w');<br />
fwrite($fp,getmypid());<br />
fclose($fp);</code></p>
<p>Then I can modify the monitoring script to kill the current collection script when no tweets are added for 10 minutes, and then restart it:<br />
<code>$process_id = file_get_contents('process_id.txt');<br />
exec('kill -9 ' . $process_id);<br />
exec('nohup php get_tweets.php > /dev/null &#038;');</code></p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
