<?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>Kastang &#187; Twitter</title>
	<atom:link href="http://kastang.com/blog/category/general/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://kastang.com</link>
	<description>Ramblings of a Geek</description>
	<lastBuildDate>Sat, 11 Jun 2011 00:30:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Push Twitter Replies to your iPhone using Prowl</title>
		<link>http://kastang.com/blog/2010/08/push-twitter-replies-to-iphone-using-prowl/</link>
		<comments>http://kastang.com/blog/2010/08/push-twitter-replies-to-iphone-using-prowl/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 23:19:24 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Prowl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=537</guid>
		<description><![CDATA[Yesterday I bought Prowl for the iPhone. Prowl is similar to Growl on OSX systems. Prowl pushes notifications to your iPhone or iTouch. One of the first uses I thought to use Prowl for was pushing my @replies and mentions from Twitter to my iPhone. I wanted to run the script from my Ubuntu server [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I bought Prowl for the iPhone. Prowl is similar to Growl on OSX systems. Prowl pushes notifications to your iPhone or iTouch. One of the first uses I thought to use Prowl for was pushing my @replies and mentions from Twitter to my iPhone. I wanted to run the script from my Ubuntu server rather then keeping my desktop on 24/7. I did a quick search online and didn't find any command line options for achieving such a task.  I decided to code a quick and dirty PHP script to accomplish what I wanted to do.</p>
<p>This is a quick hack. There are probably more efficient ways of accomplishing this task. I used <a href="http://github.com/Fenric/ProwlPHP">ProwlPHP</a> to link to the Prowl API.</p>
<p>I assume you know PHP and know how to navigate in Terminal. This is a command line app, it will run on any computer/server running PHP. I have extensively commented the script. Hopefully it is easy to follow along.</p>
<p>Quick Instructions:</p>
<ol>
<li>Download the newest version of ProwlPHP and copy it a directory.</li>
<li>Create a file lastreply.txt and stick in in the same directory as the below code will be copied into. This file needs to have read and write permissions.</li>
<li>Copy the below code into another file. Alter the ProwlPHP includes directory on line 2, and add your Prowl API key, Twitter Username, and Twitter Password in the constructor.</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//CHANGE THIS PATH TO WHERE ProwlPHP IS LOCATED ON</span>
<span style="color: #666666; font-style: italic;">//YOUR SERVER</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../API/ProwlPHP.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Twitter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * @class Twitter
 * This class integrates Twitter and Prowl notifications with the
 * iPhone. When this script runs it checks to see if any new
 * Twitter mentions have occured on your account since last check.
 * If any exist, the Tweet is sent to Prowl and will be notified
 * via push on your iPhone.
 *
 * This class uses ProwlPHP located at:
 * 			http://github.com/Fenric/ProwlPHP
 *
 * @author Kastang (josh dot kastang at gmail dot com)
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Twitter <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$lastID</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$tUser</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$tPass</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$prowl</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Constructor for Twitter Class. Three lines need to be edited
     * below before running the file: prowl, tUser, and tPass.
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//EDIT THE 3 LINES BELOW</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prowl</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Prowl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR PROWL API KEY'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tUser</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;TWITTER USERNAME&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tPass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;TWITTER PASSWORD&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//XML info loaded from Twitter API.</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">simplexml_load_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getReplies</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//Opens the lastreply file which contants the</span>
        <span style="color: #666666; font-style: italic;">//id of the last mentioned tweet.</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastID</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastreply.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//If the file is empty (probably the first time</span>
        <span style="color: #666666; font-style: italic;">//you are using the script). It will pull the</span>
        <span style="color: #666666; font-style: italic;">//newest mention id from your twitter feed and</span>
        <span style="color: #666666; font-style: italic;">//store it in the file.</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastID</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$full</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;@&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">screen_name</span> <span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">&quot;: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prowl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$full</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updateNewest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//Checks for new Twitter Mentions.</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkForUpdates</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Checks for updates.
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> checkForUpdates<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//first run boolean.</span>
        <span style="color: #000088;">$first</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//For each mention in the XML array, check to see if</span>
        <span style="color: #666666; font-style: italic;">//the current ID is greater then the last recorded ID.</span>
        <span style="color: #666666; font-style: italic;">//If it is, push the current Tweet to Prowl, if it isn't,</span>
        <span style="color: #666666; font-style: italic;">//check to see if it is the first run, if it is, break out</span>
        <span style="color: #666666; font-style: italic;">//of the for loop, if it isn't the first run, update the</span>
        <span style="color: #666666; font-style: italic;">//lastreply.txt file and break from the forloop.</span>
        <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>             <span style="color: #000088;">$curr</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$curr</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastID</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$first</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$full</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;@&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">screen_name</span> <span style="color: #339933;">.</span>
                        <span style="color: #0000ff;">&quot;: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prowl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$full</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$first</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updateNewest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Writes the newest @reply id to a file.
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> updateNewest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastreply.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Push the Tweet to Prowl. This code is modified from
     * example.php in the ProwlPHP API Wrapper.
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> prowl<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tweet</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prowl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">push</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'application'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Twitter'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'event'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$tweet</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'priority'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
                <span style="color: #009900;">&#41;</span><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>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Gets replies from Twitter. In order to grab replies, you
     * must be authenticated.
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> getReplies<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$twitterHost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://twitter.com/statuses/mentions.xml&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$curl</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$curl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HTTPAUTH<span style="color: #339933;">,</span> CURLAUTH_BASIC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_USERPWD<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$this-&gt;tUser</span>:<span style="color: #006699; font-weight: bold;">$this-&gt;tPass</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HTTP_VERSION<span style="color: #339933;">,</span> CURL_HTTP_VERSION_1_1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$twitterHost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type: application/xml; charset=ISO-8859-1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I chose to add an entry in my crontab to run this script every 10 minutes. The time can be adjusted to suit your needs. Personally I do not see a need to ping Twitter more then once every ten minutes.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">10</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> curl <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>replies.php</pre></div></div>

<p>If all goes well, you should see something like this when someone mentions you in a tweet:</p>
<div id="attachment_547" class="wp-caption aligncenter" style="width: 394px"><a href="http://kastang.com/blog/wp-content/uploads/2010/08/photo-1.png"><img class="size-full wp-image-547 " title="Prowl iPhone Lockscreen" src="http://kastang.com/blog/wp-content/uploads/2010/08/photo-1.png" alt="Prowl pushing a notification to the iPhone. " width="384" height="576" /></a><p class="wp-caption-text">Prowl pushing a notification to the iPhone. </p></div>
<p>It is possible to setup a redirection within Prowl to automatically launch your Twitter client of choice when you get a Twitter based notification. You can also open Prowl and view all notifications:</p>
<div id="attachment_548" class="wp-caption aligncenter" style="width: 394px"><a href="http://kastang.com/blog/wp-content/uploads/2010/08/photo-2.png"><img class="size-full wp-image-548 " title="Prowl Main Screen" src="http://kastang.com/blog/wp-content/uploads/2010/08/photo-2.png" alt="Prowl Main Screen" width="384" height="576" /></a><p class="wp-caption-text">Prowl Main Screen</p></div>
<p>The script should be fairly easy to modify. I will probably add Direct Messaging next to my Prowl Push Notifications.</p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2010/08/push-twitter-replies-to-iphone-using-prowl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Would you pay to use Twitter?</title>
		<link>http://kastang.com/blog/2008/11/would-you-pay-to-use-twitter/</link>
		<comments>http://kastang.com/blog/2008/11/would-you-pay-to-use-twitter/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 12:50:57 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=123</guid>
		<description><![CDATA[According to SitePoint: Author and investor Guy Kawasaki posted a poll today asking, “How much would you pay to use Twitter?” Surprisingly, about 50% said they would pay some amount, the majority thinking the service worth $5 per month. ........ In fact, in an April poll on TechCrunch, about 25% of respondents said they would [...]]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://www.sitepoint.com/blogs/2008/11/20/if-twitter-charges-users-would-pay-survey/">SitePoint</a>:</p>
<blockquote><p>Author and investor Guy Kawasaki <a href="http://twitter.com/guykawasaki/status/1012519893">posted a poll today</a> asking, “How much would you pay to use Twitter?” Surprisingly, about 50% said they would pay some amount, the majority thinking the service worth $5 per month.</p>
<p>........</p>
<p>In fact, in an <a href="http://www.techcrunch.com/2008/04/14/twitter-testing-advertising-in-twitter-streams/">April poll on TechCrunch</a>, about 25% of respondents said they would pay to have ads removed on Twitter if they service started putting ads in the feed (and 50% supported the idea of ads — which might be a better way to generate revenue than to charge end users directly).</p></blockquote>
<p>The full article can be found <a href="http://www.sitepoint.com/blogs/2008/11/20/if-twitter-charges-users-would-pay-survey/">here.</a></p>
<p>I would be willing to pay to remove ads from Twitter if they existed. I am not a huge fan of having to pay for the service though. I have always wondered how Twitter makes its money without ads or payment options.</p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2008/11/would-you-pay-to-use-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twhirl and Growl</title>
		<link>http://kastang.com/blog/2008/06/twhirl-and-growl/</link>
		<comments>http://kastang.com/blog/2008/06/twhirl-and-growl/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 00:55:26 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Growl]]></category>
		<category><![CDATA[Twhirl]]></category>

		<guid isPermaLink="false">http://kastang.com/blog/?p=12</guid>
		<description><![CDATA[I am a recent convert to Twhirl. It is my new favorite Twitter client. I formally used Twitterific. Twitterific is a great client still in my opinion, but the ads were a bit distracting and I didn't want to pay the $15 dollars for the full version (Okay, so I may be a little cheap, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/kastang/2568502703/" title="Growl and Twhirl by Kastang, on Flickr"><img src="http://farm4.static.flickr.com/3016/2568502703_b9a8a649cf_o.jpg" width="345" height="180" alt="Growl and Twhirl" /></a></p>
<p>I am a recent convert to Twhirl. It is my new favorite Twitter client. I formally used Twitterific. Twitterific is a great client still in my opinion, but the ads were a bit distracting and I didn't want to pay the $15 dollars for the full version (Okay, so I may be  a little cheap, but I can't see a reason to pay for something when there are free alternatives.) The only feature I see Twhirl missing is Growl. I asked @twhirl (on twitter) if supporting Growl was planned to be supported. As of now, its not and doesn't look like it is going to be anytime soon.</p>
<p>I believe the lack of support is a limitation of Adobe Air rather then Twhirl. Air tries to be multi compatible with different operating systems while Growl is a OSX only application. Hopefully some day Twhirl will offer support for Growl. Its not a ruiner for me personally, It has its own notification system that doesn't interfere with Growl. It would just be nice to have one notification system running since all other applications I use have support for Growl (where necessary).</p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2008/06/twhirl-and-growl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

