<?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</title>
	<atom:link href="http://kastang.com/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>Vanilla2: Enable HTML in Inbox Conversations</title>
		<link>http://kastang.com/blog/2011/06/vanilla2-enable-html-in-inbox-conversations/</link>
		<comments>http://kastang.com/blog/2011/06/vanilla2-enable-html-in-inbox-conversations/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 00:30:44 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Vanilla]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=672</guid>
		<description><![CDATA[For an unknown reason, Vanilla2 does not allow HTML in Inbox conversations. As far as I can tell, this issue has existed since the release of Vanilla2 last year. This bug has remained at least until the latest revision of Vanilla - 2.0.17.10. This solution can be easily fixed by modifying one line: /applications/conversations/views/messages/messages.php: On [...]]]></description>
			<content:encoded><![CDATA[<p>For an unknown reason, Vanilla2 does not allow HTML in Inbox conversations. As far as I can tell, this issue has existed since the release of Vanilla2 last year. This bug has remained at least until the latest revision of Vanilla - 2.0.17.10. This solution can be easily fixed by modifying one line:</p>
<p><code>/applications/conversations/views/messages/messages.php</code>:</p>
<p>On or around Line 36, change <code>Gdn_Format::To</code> to <code>Gdn_Format::Html</code>.</p>
<p>After the change, HTML will render properly in Inbox Conversations. </p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2011/06/vanilla2-enable-html-in-inbox-conversations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xkcd Comic Downloader</title>
		<link>http://kastang.com/blog/2011/04/xkcd-comic-downloader/</link>
		<comments>http://kastang.com/blog/2011/04/xkcd-comic-downloader/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 13:38:40 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[xkcd]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=661</guid>
		<description><![CDATA[I have created a simple Perl script that will locally store every xkcd comic and generate a HTML file to view all xkcd comics on a single page. After the initial run of this script, each additional run will do incremental updates (only new comics will be downloaded since the last time the script was [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a simple Perl script that will locally store every xkcd comic and generate a HTML file to view all xkcd comics on a single page. After the initial run of this script, each additional run will do incremental updates (only new comics will be downloaded since the last time the script was executed). </p>
<p>The script can be run from a command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">perl</span> xkcd.pl</pre></div></div>

<p>or, by setting xkcd.pl to executable and running it as:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>xkcd.pl</pre></div></div>

<p>The latest revision of the code can be found on <a href="https://github.com/Kastang/xkcd">Github</a>. Please read the README file on Github for Perl requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2011/04/xkcd-comic-downloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WoW Realm Status PHP Class</title>
		<link>http://kastang.com/blog/2011/03/wow-realm-status-php-class/</link>
		<comments>http://kastang.com/blog/2011/03/wow-realm-status-php-class/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 12:54:45 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WoW]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=652</guid>
		<description><![CDATA[I am working on a PHP Class called RealmStatus that will pull WoW Realm information from the WoW Realm Status Page without XML feeds available. The RealmStatus Class currently supports the following operations: --getAllServers() - Returns an associative array of all Server Names, Statuses, Populations, Types, and Locale. --getServerType($) - Returns the type of a [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a PHP Class called <a href="https://github.com/Kastang/WoWRealmStatus">RealmStatus</a> that will pull WoW Realm information from the WoW Realm Status Page without XML feeds available. </p>
<p>The RealmStatus Class currently supports the following operations:<br />
<strong> --getAllServers()</strong> - Returns an associative array of all Server Names, Statuses, Populations, Types, and Locale.<br />
<strong>--getServerType($)</strong> - Returns the type of a given server.<br />
<strong>--getServerStatus($)</strong> - Returns the status of a given server.<br />
<strong>--getServerPopulation($)</strong> - Returns the population of a given server.<br />
<strong> --getServerLocale($)</strong> - Returns the locale of a given server. </p>
<p>For a detailed explanation of the operations, please read the function headers in the RealmStatus.php and example.php files. </p>
<p>The files can be pulled from GitHub <a href="https://github.com/Kastang/WoWRealmStatus">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2011/03/wow-realm-status-php-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WoW Roster PHP Class</title>
		<link>http://kastang.com/blog/2011/01/wow-roster-php-class/</link>
		<comments>http://kastang.com/blog/2011/01/wow-roster-php-class/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 17:35:30 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WoW]]></category>
		<category><![CDATA[World of Warcraft]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=639</guid>
		<description><![CDATA[I am working on a PHP Class called RosterAPI that will parse the WoW Armory without XML Files. Unlike my previous two posts (Part 1 and Part 2), the information for each character can be pulled through get methods. Also included in RosterAPI are guild specific functions not included in my previous posts. The following [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a PHP Class called <a href="https://github.com/Kastang/No-XML-WoW-Armory-Parser">RosterAPI</a> that will parse the WoW Armory without XML Files. Unlike my previous two posts (<a href="http://kastang.com/blog/2010/12/parsing-the-wow-armory-without-xml/">Part 1</a> and <a href="http://kastang.com/blog/2011/01/parsing-the-wow-armory-without-xml-part-2/">Part 2</a>), the information for each character can be pulled through <code>get</code> methods. Also included in RosterAPI are guild specific functions not included in my previous posts. </p>
<p>The following methods are currently included:</p>
<p><strong>Character Specific: </strong><br />
* getLevel()<br />
* getGender()<br />
* getClass()<br />
* getRace()<br />
* getAchievementPoints()<br />
* getProfessions(): Returns an associative array containing the name and value of each profession.<br />
* getTalents(): Returns an associative array containing the name and value of each talent tree.<br />
* getStat($stat): Please view the comment header of the getStat() function for a list of valid $stats. </p>
<p><strong>Guild Specific: </strong><br />
* getGuildMembers($rank): If $rank is true, an associative array containing guild names and ranks will be returned. If $rank is false, an array will be returned containing all names in the guild.<br />
* getTopWeeklyContributers(): Returns an array of the Top 5 Weekly Contributers in the guild.<br />
* getGuildPerks(): Returns an array of the perks a guild currently has. </p>
<h2> <strong>UPDATE:</strong> </h2>
<p>I have received several emails with suggestions over the past week. In addition to everything listed above, my RosterAPI will also:</p>
<p>*getItems: Returns an Associative Array that will return every item equipped on a character along with the Item Level, Enchants, and Gems.<br />
*getStatistics: Given a specific Statistic (ex: Number of deaths), the value of the statistic will be returned. </p>
<p>The code can be obtained via <a href="https://github.com/Kastang/No-XML-WoW-Armory-Parser">GitHub</a>. While it is still a work in progress, it should be stable enough for personal use. This class is being used to power the backend of the <a href="http://weknow.to/roster/">We Know Roster</a>. Please read the <code>README</code> file along with the <code>example.php</code> file for a brief introduction on how to use the class. I recommend reading the comments above each function in RosterAPI to understand what exactly will be returned (especially with those functions that return associative arrays).</p>
<h1>Update #2</h1>
<p>The Roster API now returns Glyphs for each character.</p>
<h1>EDIT #2:</h1>
<p>By request in the comments, here is a Paypal Donate button:</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="hosted_button_id" value="FJVPJYYF43VTS"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2011/01/wow-roster-php-class/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Parsing the WoW Armory without XML &#8211; Part 2</title>
		<link>http://kastang.com/blog/2011/01/parsing-the-wow-armory-without-xml-part-2/</link>
		<comments>http://kastang.com/blog/2011/01/parsing-the-wow-armory-without-xml-part-2/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 02:16:28 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WoW]]></category>
		<category><![CDATA[Parsing]]></category>
		<category><![CDATA[World of Warcraft]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=624</guid>
		<description><![CDATA[This post is a continuation of my original post about parsing the WoW Armory with no XML feeds available. In my original post, I showed how to pull basic character information, such as professions and talents, from each member in a specified guild. This post will expand on more specific character information such as HP, [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a continuation of my <a href="http://kastang.com/blog/2010/12/parsing-the-wow-armory-without-xml/">original post about parsing the WoW Armory with no XML feeds available</a>. In my original post, I showed how to pull basic character information, such as professions and talents, from each member in a specified guild. This post will expand on more specific character information such as HP, MP, and Stats. </p>
<p>The <code>getCharacterInformation($charName)</code> function in my previous post can be expanded to include additional information available on the WoW Armory. (Please view my original post for the sample code). For the most part, the code below can be directly copied into the existing method. As in my previous post, I assume you have the knowledge to make minor changes to the method (such as modifying the return array).  </p>
<p><strong>Exact Health and Mana:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$health</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@class=&quot;health&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mana</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@id=&quot;summary-power&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$health</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$mana</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Exact Talents:</strong><br />
This will return the exact talent in the form of xx/xx/xx for both talents.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$exactBuilds</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//span[@class=&quot;name-build&quot;]/span[@class=&quot;build&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$exactBuilds</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$exactBuilds</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Stats and Resistances:</strong><br />
A stat listed in the comment above the code needs to be added to the <code>$stat</code> variable.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Valid $stat values:
 * strength, agility, stamina, intellect,
 * spirit, mastery, meleedamage, meleedps,
 * meleeattackpower, meleespeed, meleehaste,
 * meleehit, meleecrit, meleecrip, expertise,
 * rangeddamage, rangeddps, rangedattackpower,
 * rangedspeed, rangedhaste, rangedhit, rangedcrit,
 * spellpower, spellhaste, spellhit, spellcrit,
 * spellpenetration, manaregen, combatregen, armor,
 * dodge, parry, block, resilience, arcaneres, fireres,
 * frostres, natureres, shadowres,
 */</span>
&nbsp;
<span style="color: #000088;">$stat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ADD_STAT_FROM_ABOVE_HERE&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$statName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@data-id=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$stat</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;]/span[@class=&quot;name&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$statValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@data-id=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$stat</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$statName</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$statValue</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Battleground Rating and Kills</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$rating</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@class=&quot;rating&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$kills</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//li[@class=&quot;kills&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$rating</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$kills</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>My next post will cover looking into more interesting character information such as Achievements, Reputation, or Statistics. </p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2011/01/parsing-the-wow-armory-without-xml-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsing the WoW Armory without XML</title>
		<link>http://kastang.com/blog/2010/12/parsing-the-wow-armory-without-xml/</link>
		<comments>http://kastang.com/blog/2010/12/parsing-the-wow-armory-without-xml/#comments</comments>
		<pubDate>Sat, 01 Jan 2011 02:16:01 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WoW]]></category>
		<category><![CDATA[World of Warcraft]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=602</guid>
		<description><![CDATA[A month or so ago Blizzard moved the WoW Armory to Battle.net servers. Currently, the new WoW Armory does not offer XML feeds for the data.  I spent a few hours working with PHP and DOM to create a 'parser' for the new Armory.  The below script is a trimmed down version of what is [...]]]></description>
			<content:encoded><![CDATA[<p>A month or so ago Blizzard moved the WoW Armory to Battle.net servers. Currently, the new WoW Armory does not offer XML feeds for the data.  I spent a few hours working with PHP and DOM to create a 'parser' for the new Armory.  The below script is a trimmed down version of what is currently being used for the <a href="http://weknow.to/roster/" target="_blank">We Know Roster</a>. I am only providing the back end script that will do the parsing and store the information in a MySQL database. Front end displaying can easily be achieved by querying the database with the stored results.</p>
<p>The script will pull the following information for each member in a specified guild: Name, Level, Class, Rank, Achievement Points, Profession 1 Name+Level, Profession 2 Name+Level, Talent1, and Talent2.</p>
<p>The scripts below require modifications to work properly. I recommend having knowledge of PHP/CLI before working with this script. <strong>I will develop a more user friendly version of this script only if Blizzard does not supply useful XML or JSON feeds in a reasonable amount of time.</strong></p>
<h2>The Bash Script:</h2>
<p>The bash script pulls the newest HTML Roster file from the new Armory. This could probably be pulled via the PHP script, but since the file is several thousand lines long, I found it more efficient to save the file first and read it locally.</p>
<p>Please pay special attention to the paths, they will need to be altered in order to work correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#Replace YOUR_GUILD_NAME_HERE with your guild name. If your Guild Name is two or more words, it should be in the format</span>
<span style="color: #666666; font-style: italic;">#of Your%20Guild%20Name</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">--directory-prefix</span>=<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>your<span style="color: #000000; font-weight: bold;">/</span>desired<span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span> http:<span style="color: #000000; font-weight: bold;">//</span>us.battle.net<span style="color: #000000; font-weight: bold;">/</span>wow<span style="color: #000000; font-weight: bold;">/</span>en<span style="color: #000000; font-weight: bold;">/</span>guild<span style="color: #000000; font-weight: bold;">/</span>YOUR_SERVER_HERE<span style="color: #000000; font-weight: bold;">/</span>YOUR_GUILD_NAME_HERE<span style="color: #000000; font-weight: bold;">/</span>roster
<span style="color: #c20cb9; font-weight: bold;">mv</span> <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>your<span style="color: #000000; font-weight: bold;">/</span>desired<span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>roster <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>your<span style="color: #000000; font-weight: bold;">/</span>desired<span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>roster.html
php <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>php<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span>ParseRoster.php</pre></div></div>

<h2>The SQL Dump:</h2>
<p>Import this into a MySQL database.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Table structure for table `roster`</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`roster`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`name`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`race`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`class`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`level`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`rank`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`ap`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`prof1name`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`prof1value`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`prof2name`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`prof2value`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`talent1`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`talent2`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1 <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> ;</pre></div></div>

<h2>The PHP Backend:</h2>
<p>The PHP file should be fairly straight forward.</p>
<p>A few notes:</p>
<ul>
<li>I have a config file that holds information for my database, if you have a similar file you should include it, otherwise add in the proper mysql_connect() information.</li>
<li>Make sure the path to the Roster.html file is correct.</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #339933;">&lt;</span> ?php
<span style="color: #009933; font-style: italic;">/**
 * This script will parse the new WoW Armory without an XML file.
 * This script will currently pull the Name, Level, Class, Race,
 * Achievement Points, Professions, and Talents of every member
 * In a specified guild. The script works for me but may not work
 * as expected on every system. Use at your own risk.
 *
 * @author Josh Grochowski (josh[dot]kastang[at]gmail[dot]com)
 *
 */</span>
&nbsp;
<span style="color: #990000;">set_time_limit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/path/to/config/file.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
getRosterInformation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getRosterInformation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000088;">$roster</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;/path/to/roster/file/roster.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> domDocument<span style="color: #339933;">;</span>
    <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadHTML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$roster</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">preserveWhiteSpace</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//The first tbody tag marks the start of the actual</span>
    <span style="color: #666666; font-style: italic;">//'roster' part of the html.</span>
    <span style="color: #000088;">$roster</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tbody'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Each Character has its own tr block.</span>
    <span style="color: #000088;">$char</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$roster</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$char</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//Character information is split into individual</span>
        <span style="color: #666666; font-style: italic;">//td blocks.</span>
        <span style="color: #000088;">$charInfo</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'td'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$charImages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//I only care about active characters. Inactive characters</span>
        <span style="color: #666666; font-style: italic;">//will display 0 Achievement points.</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$charInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$charInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$race</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$charImages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'src'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$charImages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'src'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$level</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$charInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$rank</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$charInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$ap</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$charInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">//Returns an array containing the professions name/level and</span>
                <span style="color: #666666; font-style: italic;">//talents of each individual character.</span>
                <span style="color: #000088;">$charArray</span> <span style="color: #339933;">=</span> getCharacterInformation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO roster(name,race,class,level,rank,ap,prof1name,prof1value,prof2name,prof2value,talent1,talent2)
                                VALUES('<span style="color: #006699; font-weight: bold;">$name</span>','<span style="color: #006699; font-weight: bold;">$race</span>','<span style="color: #006699; font-weight: bold;">$class</span>','<span style="color: #006699; font-weight: bold;">$level</span>','<span style="color: #006699; font-weight: bold;">$rank</span>','<span style="color: #006699; font-weight: bold;">$ap</span>','<span style="color: #006699; font-weight: bold;">$charArray[profName1]</span>','<span style="color: #006699; font-weight: bold;">$charArray[profValue1]</span>',
                                '<span style="color: #006699; font-weight: bold;">$charArray[profName2]</span>','<span style="color: #006699; font-weight: bold;">$charArray[profValue2]</span>','<span style="color: #006699; font-weight: bold;">$charArray[talent1]</span>','<span style="color: #006699; font-weight: bold;">$charArray[talent2]</span>')&quot;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</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;">//Wait 5 seconds inbetween queries to keep from getting banned from WoW Armory servers.</span>
                <span style="color: #666666; font-style: italic;">//This can probably be adjusted to three or four seconds, but if you do get banned, it can</span>
                <span style="color: #666666; font-style: italic;">//last las long as 48 hours.</span>
                <span style="color: #990000;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getCharacterInformation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$charName</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//link to characters page on WoW Armory</span>
    <span style="color: #000088;">$charInfo</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;http://us.battle.net/wow/en/character/eitrigg/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$charName</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/simple&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> domDocument<span style="color: #339933;">;</span>
    <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadHTML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$charInfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">preserveWhiteSpace</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Profession Names</span>
    <span style="color: #000088;">$xpath</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMXPath<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$profName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//span[@class=&quot;profession-details&quot;]/span[@class=&quot;name&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Profession Values</span>
    <span style="color: #000088;">$profValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//span[@class=&quot;profession-details&quot;]/span[@class=&quot;value&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Talents</span>
    <span style="color: #000088;">$talents</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//span[@class=&quot;name-build&quot;]/span[@class=&quot;name&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$charArray</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;profName1&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$profName</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">&quot;profValue1&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$profValue</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">&quot;profName2&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$profName</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">&quot;profValue2&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$profValue</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">&quot;talent1&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$talents</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">&quot;talent2&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$talents</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$charArray</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2010/12/parsing-the-wow-armory-without-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Python to Parse WoW Server XML.</title>
		<link>http://kastang.com/blog/2010/12/using-python-to-parse-wow-server-xml/</link>
		<comments>http://kastang.com/blog/2010/12/using-python-to-parse-wow-server-xml/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 00:22:11 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[WoW]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=578</guid>
		<description><![CDATA[THIS CODE IS OBSOLETE. Blizzard changed the way information can be grabbed from their servers. Please view my PHP Class which will work. The below Python script will parse the WoW Server XML file and return status, type, name, and load about a specified WoW Server. It also stores the Server XML file into a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>THIS CODE IS OBSOLETE. Blizzard changed the way information can be grabbed from their servers. Please view <a href="http://kastang.com/blog/2011/03/wow-realm-status-php-class/">my PHP Class</a> which will work. </strong></p>
<p>The below Python script will parse the WoW Server XML file and return status, type, name, and load about a specified WoW Server. It also stores the Server XML file into a cache.txt file so constant requests to the script will not result in an IP ban on Blizzards servers.</p>
<p>Python 2.6+ must be used for this script to function correctly. It will work out of the box with no third party libraries required.</p>
<p>Please change the SERVER_NAME (on line 32) variable to your servers name.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
Author: Josh Grochowski (Kastang)
&nbsp;
This script will parse the WoW Server Status XML file and return
information about a specified server. This Python script works
for me, but it may not work for you. Use this script at your
own risk. 
&nbsp;
Python 2.6+ must be used.
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
The below four lines assume this script will be loaded onto a
webserver. If you are planning to run this script in a CLI
enviornment, feel free to remove the below four lines of code.
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">cgitb</span>
<span style="color: #dc143c;">cgitb</span>.<span style="color: black;">enable</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Content-Type: text/html;charset=utf-8&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Imports</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">etree</span>.<span style="color: black;">ElementTree</span> <span style="color: #ff7700;font-weight:bold;">import</span> parse
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>, <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">time</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#WoW Server Status Path</span>
WOW_XML = <span style="color: #483d8b;">&quot;http://www.worldofwarcraft.com/realmstatus/status.xml&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Change SERVER_NAME to the your server.</span>
SERVER_NAME = <span style="color: #483d8b;">&quot;Eitrigg&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Display information for the Realm information.</span>
rStatus = <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Offline&quot;</span>, <span style="color: #483d8b;">&quot;Online&quot;</span><span style="color: black;">&#93;</span>
rType = <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #483d8b;">&quot;PVE&quot;</span>, <span style="color: #483d8b;">&quot;PVP&quot;</span>, <span style="color: #483d8b;">&quot;RP&quot;</span>, <span style="color: #483d8b;">&quot;RP PVP&quot;</span><span style="color: black;">&#93;</span>
rLoad = <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #483d8b;">&quot;Low&quot;</span>, <span style="color: #483d8b;">&quot;Medium&quot;</span>, <span style="color: #483d8b;">&quot;High&quot;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Modification time of the cache file.</span>
modTime =  <span style="color: #dc143c;">os</span>.<span style="color: #dc143c;">stat</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cache.txt&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">st_mtime</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Current system time.</span>
currTime =  <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
If this function is called, the cache file will be
updated with the newest information from the WoW
Server Status XML file.
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> updateCache<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    cache = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cache.txt&quot;</span>, <span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
    cache.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>WOW_XML<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
Given a Realm name and XML file, it will find the
XML string containing information about the specified
Realm and return it to the requesting function.
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> findRealm<span style="color: black;">&#40;</span>realm, <span style="color: #dc143c;">xml</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'rs/r'</span><span style="color: black;">&#41;</span>:
                <span style="color: #ff7700;font-weight:bold;">if</span> l.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'n'</span><span style="color: black;">&#41;</span> == realm:
                        <span style="color: #ff7700;font-weight:bold;">return</span> l
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Displays information about the specified Server.</span>
<span style="color: #ff7700;font-weight:bold;">def</span> printOutput<span style="color: black;">&#40;</span>server<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Realm Name: &quot;</span> + server.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'n'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Realm Type: &quot;</span> + rType<span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>server.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'t'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Realm Status: &quot;</span> + rStatus<span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>server.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'s'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Realm Load: &quot;</span> + rLoad<span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>server.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'l'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
If the cache file has not been updated for 10 minutes,
it will be updated. Otherwise, the existing file will
be used to find current information about the specified
realm. 
&nbsp;
If the specified Realm is not a valid WoW Realm, nothing
will be returned. 
&nbsp;
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>currTime - modTime<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff4500;">600</span>:
        updateCache<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #dc143c;">xml</span> = parse<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cache.txt&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">getroot</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    server = findRealm<span style="color: black;">&#40;</span>SERVER_NAME, <span style="color: #dc143c;">xml</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> server <span style="color: #66cc66;">!</span>= <span style="color: #008000;">False</span>:
        printOutput<span style="color: black;">&#40;</span>server<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>A sample output can be seen below:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># python realmstatus.py</span>
Realm Name: Eitrigg
Realm Type: PVE
Realm Status: Online
Realm Load: High</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2010/12/using-python-to-parse-wow-server-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: AWStats and phpMyAdmin to Display Properly Using Nginx and Apache</title>
		<link>http://kastang.com/blog/2010/08/howto-awstats-and-phpmyadmin-to-display-properly-using-nginx-and-apache/</link>
		<comments>http://kastang.com/blog/2010/08/howto-awstats-and-phpmyadmin-to-display-properly-using-nginx-and-apache/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 16:17:26 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[AWStats]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[phpMyAdmin]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=566</guid>
		<description><![CDATA[I am now using Nginx to handle the static content on my server while using Apache to handle the dynamic content. Overall I am very happy with the switch. One issue I had was the images in AWStats and phpMyAdmin were not displaying because the static file regular expression I am using was overriding my [...]]]></description>
			<content:encoded><![CDATA[<p>I am now using Nginx to handle the static content on my server while using Apache to handle the dynamic content. Overall I am very happy with the switch. One issue I had was the images in AWStats and phpMyAdmin were not displaying because the static file regular expression I am using was overriding my /awstats location rule. The fix is quite easy. A new rule needs to be setup to override the original static file regular expression. </p>
<p>This code will only work if you are using Nginx to forward non static requests to Apache.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> location ~<span style="color: #000000; font-weight: bold;">*</span> ^<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>awstats<span style="color: #000000; font-weight: bold;">|</span>phpmyadmin<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
                proxy_pass http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">8080</span>;
                include <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>proxy.conf;
        <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>If you are already setup using Nginx + Apache, chances are you have a file similar to this below. If you have the proxy configurations copied and pasted into your files I would recommend making an includes file to keep your configuration files clean and readable.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">proxy_redirect off;
&nbsp;
proxy_set_header Host <span style="color: #007800;">$host</span>;
proxy_set_header X-Real-IP <span style="color: #007800;">$remote_addr</span>;
proxy_set_header X-Forwarded-For <span style="color: #007800;">$proxy_add_x_forwarded_for</span>;
&nbsp;
client_max_body_size 10m;
client_body_buffer_size 128k;
&nbsp;
proxy_connect_timeout <span style="color: #000000;">90</span>;
proxy_send_timeout <span style="color: #000000;">90</span>;
proxy_read_timeout <span style="color: #000000;">90</span>;
&nbsp;
proxy_buffer_size 32k;
proxy_buffers <span style="color: #000000;">8</span> 16k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;</pre></div></div>

<p>Quite simple to accomplish, though I will admit it took me a few minutes to figure out. Hope this helps. </p>
]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2010/08/howto-awstats-and-phpmyadmin-to-display-properly-using-nginx-and-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Push Daily Weather to your iPhone using Prowl</title>
		<link>http://kastang.com/blog/2010/08/push-daily-weather-to-your-iphone-using-prowl/</link>
		<comments>http://kastang.com/blog/2010/08/push-daily-weather-to-your-iphone-using-prowl/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 13:18:13 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Prowl]]></category>
		<category><![CDATA[Weather]]></category>

		<guid isPermaLink="false">http://kastang.com/?p=556</guid>
		<description><![CDATA[Below is a PHP script that will pull your daily local weather forecast from Weather Bug and push it to your iPhone using Prowl. One requirement is you have the Prowl iPhone app on your iPhone or iTouch. Prowl is $2.99 in the App Store. This script also requires PHP to be installed on your [...]]]></description>
			<content:encoded><![CDATA[<p>Below is a PHP script that will pull your daily local weather forecast from Weather Bug and push it to your iPhone using Prowl. One requirement is you have the Prowl iPhone app on your iPhone or iTouch. Prowl is $2.99 in the App Store. This script also requires PHP to be installed on your server/desktop machine. I have tested this script with a handful of random Zip Codes around the US. If I happen to come up with any special conditions, I will update the script below.  </p>
<p>Before running this script, make sure you change the XXXXX's in <code>$xml</code> to your local zip code and change YOUR_API_KEY_HERE in <code>$prowl</code> to your Prowl API code. You will also need to change <code>includes('API/ProwlPHP')</code> to the location of <a href="http://github.com/Fenric/ProwlPHP">ProwlPHP</a> on your server.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * This script pulls a local XML weather forcast from
 * Weatherbug. Pushes the current days weather to a
 * device running prowl.
 *
 * This script requires ProwlPHP, and a valid Prowl API code.
 *
 * @author Kastang (josh at kastang.com)
 */</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>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Change the XXXXX's to your local zip code.</span>
    <span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">simplexml_load_file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://feeds.weatherbug.com/rss.aspx?zipcode=XXXXX&amp;feed=fcst&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Parse the description from Weatherbug.</span>
    prowl<span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">channel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</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;">description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">22</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;">//Push the weather to Prowl.</span>
    <span style="color: #000000; font-weight: bold;">function</span> prowl<span style="color: #009900;">&#40;</span><span style="color: #000088;">$weather</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$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_API_KEY_HERE'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$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;">'Weather'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'event'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Today'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'description'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$weather</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></pre></div></div>

<p>I have this setup daily to run at 8am using cron. Below is an example you should add to crontab if you want to do the same thing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">8</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>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>weather.php</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kastang.com/blog/2010/08/push-daily-weather-to-your-iphone-using-prowl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
	</channel>
</rss>
~               

