<?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>Internet Marketing - Bobby Jason &#187; PHP</title>
	<atom:link href="http://bobbyjason.co.uk/blog/category/tutorials/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://bobbyjason.co.uk/blog</link>
	<description>Internet Marketing From a Web Developer</description>
	<lastBuildDate>Thu, 05 Jan 2012 22:30:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building a Data Feed Driven Website (with @WebgainsUK Feeds)</title>
		<link>http://bobbyjason.co.uk/blog/137/building-a-data-feed-driven-website-with-webgainsuk-feeds/</link>
		<comments>http://bobbyjason.co.uk/blog/137/building-a-data-feed-driven-website-with-webgainsuk-feeds/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 00:07:15 +0000</pubDate>
		<dc:creator>BobbyJason</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[data feeds]]></category>
		<category><![CDATA[webgains]]></category>

		<guid isPermaLink="false">http://bobbyjason.co.uk/blog/?p=137</guid>
		<description><![CDATA[Part 1: Webgains Data feed Introduction
Where  I work (@WebgainsUK), we often have a lot of affiliates contact us that  want help with regard to data feeds. Whilst a lot of these queries tend  to be technical questions relating to an issue with the feed, or  reporting a problem with a merchant&#8217;s [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><strong>Part 1: Webgains Data feed Introduction</strong></p>
<p>Where  I work (<a href="http://twitter.com/WebgainsUK" target="_blank">@WebgainsUK</a>), we often have a lot of affiliates contact us that  want help with regard to data feeds. Whilst a lot of these queries tend  to be technical questions relating to an issue with the feed, or  reporting a problem with a merchant&#8217;s feed; some of these requests  are as technical as asking how to build a site using the data feeds, how  to import feeds into the database, or asking how to build a price  comparison site. Sadly, as much as Webgains try to help with these sorts  of questions wherever possible, it&#8217;s simply not possible to offer the  in-depth time-consuming answer required due to the nature of the task in  hand.</p>
<p>Thankfully, there are tools out there such as <a href="http://www.easycontentunits.com" target="_blank">Easy Content  Units</a>, which allows affiliates to insert content units into their site  without requiring any knowledge of data feeds. A plus point of being a  Webgains affiliate is that Webgains is partnered with Easy Content Units  and as such get the service for free. However, having 3&#215;3, 4&#215;4 or other  size grids of products powered by someone else&#8217;s website isn&#8217;t always  what an affiliate wants &#8211; some folks want to do their own thing, and  know how it works. Also, having products powered by Easy Content Units  doesn&#8217;t do much for your SEO; you can&#8217;t index each individual product,  you can&#8217;t have an in-built search, you can&#8217;t categorise your products,  and you&#8217;re also relying on their server be up 100% of the time. Throw in  a few other excuses for not wanting to use it, and you have a  compelling reason why affiliates are asking how to build their own data  driven website.</p>
<p>So with that in mind, I figured I&#8217;d have a go at  providing a solution in the format of a guide, &#8220;Building a Data Feed  Driven Website&#8221;. This guide will come in several parts, I have no idea  how many parts it will be, and I have no idea if I will ever finish it.  First things first though, let&#8217;s set out the objective.</p>
<p>Objective</p>
<p>To build a website that:<br />
&gt; is able to download data feeds from Webgains on a regular basis, so that the prices are always correct.<br />
&gt; can display 1 product per page for SEO reasons.<br />
&gt; has SEO friendly URLs<br />
&gt; can categorise products.<br />
&gt; has a neat search facility.<br />
&gt; has a voucher facility to accompany the products.<br />
&gt; can list the latest offers and promotions from merchants.</p>
<p>For  now, that can be the &#8217;simplistic&#8217; objective &#8211; we can always add to it  later if we desire. Notice how the requirement mentions &#8216;data feeds from  Webgains&#8217;; the reason for this is that as a Webgains employee, I feel I  have a duty to not help you promote other networks. If by reading my  guide, you feel technically inclined to mash the code to allow you to  download feeds from other networks then feel free, but don&#8217;t ask me how  <img src='http://bobbyjason.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Tools/Resources/Knowledge Required</strong></p>
<p>Basic understanding  of affiliate marketing is a given; you should know what products you  want to promote, you should know what a data feed is, you should know why  you are reading this, and you should know what it is you want to  achieve. It&#8217;s probably worth noting that you won&#8217;t get very far without a  Webgains affiliate account. <a href="http://www.webgains.com/signup.html" target="_blank">Signup to Webgains here</a>.</p>
<p>Ultimately,  you are going to need access to a server capable of running PHP5 &amp;  MySQL5. In terms of getting a server up and running with PHP5 and  MySQL5, I&#8217;m afraid it is beyond the realm of this guide. However, if you  have a spare computer laying around; may I suggest that you install  Ubuntu. If you need help with that, Google this: &#8220;ubuntu LAMP server&#8221;.  Failing that, you could always try a webhost like Fasthosts.</p>
<p>In  addtion, you will need a decent text editor (Notepad++, or EditPlus[I  use this]) and a willingness to learn. As this guide is meant to be a  resource to those who already have a basic understanding of PHP &amp;  MySQL, you will have to &#8216;catch up&#8217; where necessary. If possible, I&#8217;ll  try to give, &#8216;beginners guide tips&#8217; &#8211; but the ultimate goal is for you  to reach the objective, so maybe a twitter account will be required so  you can ask me questions: <a href="http://twitter.com/bobbyjason" target="_blank">@bobbyjason</a>.</p>
<p><strong>Notes</strong></p>
<p>Due to the  nature of complexities of this project (it&#8217;s not such a small project  after all), I&#8217;m going to code the site in sections of how to do each  bit. I can&#8217;t promise that the final project will involve all the final  bits being put together, as each section is meant to be a mini-guide in  it&#8217;s own right. Again, throw any questions my way: @bobbyjason.</p>
<p><strong>Getting Started</strong></p>
<p>The  most obvious place to start, is at the heart of the problem; data feeds.  If you knew how to work with data feeds, and you knew how to load them  into a database &#8211; you probably wouldn&#8217;t be reading this guide, so it is  for that reason I have decided to start here. For the sake of brevity,  I&#8217;m not going to explain in detail the difference between downloading a  datafeed directly, and downloading a feed via a URL. In short, for our  objective we want to download the feed via a URL as this will allow our  website to be automated.</p>
<p>So, head over to the &#8220;Data feed url  generator&#8221; and select the &#8220;xml&#8221; option, rather than &#8220;csv&#8221;. XML is a much  more structured approach, and it makes life much easier where trying to  find a problem when things go wrong &#8211; plus, I prefer working with XML  and its MY guide! Select the &#8220;.gz&#8221; option &#8211; this is the only option that  allows you to download a compressed feed immediatly. &#8220;.zip&#8221;, and  &#8220;.tar.gz&#8221; required you to hang around a little &#8211; not so good. Select ONE  of the programs, not all &#8211; but ONE. You can then select &#8216;All&#8217; at the categories  option, and select the &#8216;exended&#8217; fields option. Finally, enter your  username and password, and grab the URL &#8211; you should something that  looks similar to this:</p>
<p>http://content.webgains.com/affiliates/datafeed.html?action=download&amp;campaign=<strong>12345</strong>&amp;username=<strong>username@website.com</strong>&amp;password=<strong>password</strong>&amp;format=xml&amp;zipformat=gzip_notar&amp;fields=extended&amp;programs=<strong>1234</strong>&amp;categories=all</p>
<p>If  you have a URL like the one above (with the correct username and  password), you should be able paste it into your browser and download a  .gz compressed feed of the program you selected. Notice how you can  replace the &#8220;programs&#8221; parameter with any other program ID to download a  feed for a different program. Straight away you should be able to see  the logic required here; we need to create a PHP script that can loop  through each of the programs&#8217; feeds that we wish to download, and enter  the correct program ID. In psuedo form, here it is:</p>
<p>foreach program<br />
&#8230;.download feed for this program<br />
end foreach</p>
<p>Of  course, in reality we don&#8217;t want to just download the feed, we also  want to take the data out of it and populate our database, but I figured  baby steps would be best as not every one will understand that just  yet. So let&#8217;s get sizzling. Glancing at the clock I can see that it is  18/10/2010 22:17 &#8211; this means that I am missing the last episode of The  Inbetweeners which is rather upsetting. Thankfully we have 4OD in this  modern world, so I&#8217;ll create this script and then head off to bed!</p>
<pre style="font-size: 12px;">&lt;?php /* lesson1.php */

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);

// Create an array of the programs that we want to download
$programs = array(4084, 116);

print "Starting...\n";

// PHP foreach loop.
foreach ($programs as $program_id)
{
 // Use the "sprintf" function to pass the correct values to the string.
 // Also, splitting up the string to avoid long lines of code.
 $feed_url = sprintf('http://content.webgains.com/affiliates/datafeed.html?'.
 'action=download&amp;campaign=%s&amp;username=%s&amp;password=%s'.
 '&amp;format=xml&amp;zipformat=gzip_notar&amp;fields=extended'.
 '&amp;programs=%d&amp;categories=all',
12345, 'USERNAME', 'PASSWORD',$program_id);

 // Set the path of where you would like to save the file.
 $file = '/home/chops/xml/guide/feeds/'.$program_id.'.xml';
 $compressed = $file.'.gz';

 // Download the file (requires function, 'curl_get_file_contents'
 $data = curl_get_file_contents($feed_url);

 // Open the file for writing, write, and close the file.
 $fp = fopen($compressed, 'w+');
 fwrite($fp, $data);
 fclose($fp);

 // Call the a UNIX command to unzip the file, and move it to our desired location.
 shell_exec("gunzip -c $compressed &gt; $file");

}

print "Done.\n";

// Function to download a file.
function curl_get_file_contents($url)
{
 // Output something so we know it's working.
 print "Downloading '".$url."'\n";
 flush();

 $c = curl_init();
 curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($c, CURLOPT_URL, $url);
 curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 5000);
 curl_setopt($c, CURLOPT_TIMEOUT, 10000);
 $contents = curl_exec($c);
 curl_close($c);

 return $contents;
}
?&gt;</pre>
<p>You  can copy that code into a text document, save it as &#8216;lesson1.php&#8217; (be  sure to replace username, password and campaignid with your values!).  You can call the script directly in a browser if you wish, personally I  shall use the terminal. The files will be downloaded to the specified location. Note: If there are any PHP Gurus out there, you  will notice that this code may not be the most complex, but I&#8217;m trying  to keep it simple for those that may not be so familiar with PHP.</p>
<p>All the script does is:<br />
&gt; loop through our selected programs.<br />
&gt; downloads the compressed feed.<br />
&gt; extracts the compressed file with the name of {program_id}.xml</p>
<p>For now that will have to do, because I want to publish this blog post and go to bed. I hope it&#8217;s useful to somebody!</p>
<p>Coming up: How to parse the XML files and insert the products into a database.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29&amp;bodytext=Part%201%3A%20Webgains%20Data%20feed%20Introduction%0D%0A%0D%0AWhere%20%20I%20work%20%28%40WebgainsUK%29%2C%20we%20often%20have%20a%20lot%20of%20affiliates%20contact%20us%20that%20%20want%20help%20with%20regard%20to%20data%20feeds.%20Whilst%20a%20lot%20of%20these%20queries%20tend%20%20to%20be%20technical%20questions%20relating%20to%20an%20issue%20with%20th" title="Digg"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29&amp;notes=Part%201%3A%20Webgains%20Data%20feed%20Introduction%0D%0A%0D%0AWhere%20%20I%20work%20%28%40WebgainsUK%29%2C%20we%20often%20have%20a%20lot%20of%20affiliates%20contact%20us%20that%20%20want%20help%20with%20regard%20to%20data%20feeds.%20Whilst%20a%20lot%20of%20these%20queries%20tend%20%20to%20be%20technical%20questions%20relating%20to%20an%20issue%20with%20th" title="del.icio.us"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;t=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="Facebook"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;h=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="NewsVine"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="Reddit"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="StumbleUpon"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29&amp;annotation=Part%201%3A%20Webgains%20Data%20feed%20Introduction%0D%0A%0D%0AWhere%20%20I%20work%20%28%40WebgainsUK%29%2C%20we%20often%20have%20a%20lot%20of%20affiliates%20contact%20us%20that%20%20want%20help%20with%20regard%20to%20data%20feeds.%20Whilst%20a%20lot%20of%20these%20queries%20tend%20%20to%20be%20technical%20questions%20relating%20to%20an%20issue%20with%20th" title="Google Bookmarks"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;submitHeadline=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29&amp;submitSummary=Part%201%3A%20Webgains%20Data%20feed%20Introduction%0D%0A%0D%0AWhere%20%20I%20work%20%28%40WebgainsUK%29%2C%20we%20often%20have%20a%20lot%20of%20affiliates%20contact%20us%20that%20%20want%20help%20with%20regard%20to%20data%20feeds.%20Whilst%20a%20lot%20of%20these%20queries%20tend%20%20to%20be%20technical%20questions%20relating%20to%20an%20issue%20with%20th&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29%20-%20http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F" title="Twitter"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F" title="Technorati"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="Live"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;title=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29&amp;source=Internet+Marketing+-+Bobby+Jason+Internet+Marketing+From+a+Web+Developer&amp;summary=Part%201%3A%20Webgains%20Data%20feed%20Introduction%0D%0A%0D%0AWhere%20%20I%20work%20%28%40WebgainsUK%29%2C%20we%20often%20have%20a%20lot%20of%20affiliates%20contact%20us%20that%20%20want%20help%20with%20regard%20to%20data%20feeds.%20Whilst%20a%20lot%20of%20these%20queries%20tend%20%20to%20be%20technical%20questions%20relating%20to%20an%20issue%20with%20th" title="LinkedIn"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;t=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29" title="MySpace"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
</ul>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F137%2Fbuilding-a-data-feed-driven-website-with-webgainsuk-feeds%2F&amp;linkname=Building%20a%20Data%20Feed%20Driven%20Website%20%28with%20%40WebgainsUK%20Feeds%29"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Save/Bookmark"/></a>

<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bobbyjason.co.uk/blog/137/building-a-data-feed-driven-website-with-webgainsuk-feeds/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Hacking TweetMyBlog (TwitterFeed Sucks)</title>
		<link>http://bobbyjason.co.uk/blog/64/hacking-tweetmyblog-twitterfeed-sucks/</link>
		<comments>http://bobbyjason.co.uk/blog/64/hacking-tweetmyblog-twitterfeed-sucks/#comments</comments>
		<pubDate>Sun, 17 May 2009 14:12:27 +0000</pubDate>
		<dc:creator>BobbyJason</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bit.ly]]></category>
		<category><![CDATA[tinyurl]]></category>
		<category><![CDATA[tweetmyblog]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitterfeed]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bobbyjason.co.uk/blog/?p=64</guid>
		<description><![CDATA[I used to use TwitterFeed; but recently it&#8217;s been a real pain in the ass and not updating so I looked for an alternative.
Roll on TweetMyBlog.
TweetMyBlog is great for the simple fact that it is a WordPress plugin. It&#8217;s also a small download, and you can install it very easily. However, TweetMyBlog is hard-coded to [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I used to use TwitterFeed; but recently it&#8217;s been a real pain in the ass and not updating so I looked for an alternative.</p>
<p>Roll on TweetMyBlog.</p>
<p>TweetMyBlog is great for the simple fact that it is a WordPress plugin. It&#8217;s also a small download, and you can install it very easily. However, TweetMyBlog is hard-coded to use TinyURL and the URL it &#8220;makes tiny&#8221; is an affiliate link taking the user to a framed page. This is a bit of a bummer for me because I like to use bit.ly and I don&#8217;t really want my users going to some 3rd party site.</p>
<p>Roll on TweetMyBlog Hack</p>
<p>I took at a look @ the files and realise we can very easily change the Plugin to use bit.ly instead of TinyURL using the <a title="bit.ly api" href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation" target="_blank">bit.ly API</a>.</p>
<p>If you have installed TweetMyBlog you would have uploaded the &#8220;tweetmyblog&#8221; directory which had 3 files in it. Go and find, &#8220;twitter_api.php&#8221;:</p>
<p>and at the very bottom of the file you will see:</p>
<p>&#8221;</p>
<pre>function get_tiny_url($url)
{
$this-&gt;snoopy-&gt;fetch('http://tinyurl.com/api-create.php?url='.$url);
return $this-&gt;snoopy-&gt;results;
}</pre>
<p>&#8221;<br />
As you can see, it uses TinyURL.</p>
<p>I&#8217;ve only hacked it to use bit.ly, but this is what I changed it to first (don&#8217;t copy it yet, there&#8217;s a better version further down):</p>
<p>&#8221;</p>
<pre>   function get_tiny_url($url)
	{
    $this-&gt;snoopy-&gt;fetch('http://api.bit.ly/shorten?version=2.0.1&amp;login=bobbyjason&amp;apiKey=MYLONG_BIT_LY_API_KEY&amp;format=text&amp;longUrl='.$url);
	 return $this-&gt;snoopy-&gt;results;
	}</pre>
<p>&#8221;<br />
I gave it a shot, and sure enough it worked, I was using bit.ly instead of tinyurl, result! However, it was still using the silly Affiliate link with a frame &amp; 3rd party site.</p>
<p>Okay, open &#8220;tweetmyblog.php&#8221; at around line 36 you will see:</p>
<pre>$tweet = trim($tweetPrefix).' '.$blogPost-&gt;post_title.' '.$t-&gt;get_tiny_url('http://www.tweetmyblog.com/bpredir.php?r='.$tmb_affid.'&amp;bp='. urlencode(get_permalink($postID)));</pre>
<p>The problem is the tweetmyblog.com redirection, so I replaced it with this:</p>
<pre>$tweet = trim($tweetPrefix).' '.$blogPost-&gt;post_title.' '.$t-&gt;get_tiny_url(urlencode(get_permalink($postID)));</pre>
<p>Easy, right?</p>
<p>Well, this works great.</p>
<p>I do not need to use TwitterFeed ever again because WordPress automatically Tweets my blog post! I don&#8217;t have to wait 30 minutes, 1 hour, 5 hours for TwitterFeed to notice my blog post.</p>
<p>There was one last change that I made; after using the code above (using the bit.ly api) I realised that the URL wasn&#8217;t showing up in my bit.ly history. I checked this out and realised I needed to use the history=1 parameter. After I added this I&#8217;ve not had a single problem at all.<br />
For the final code of &#8220;twitter_api.php&#8221;, see below:</p>
<pre>function get_tiny_url($url)
	{
    $this-&gt;snoopy-&gt;fetch('http://api.bit.ly/shorten?version=2.0.1&amp;history=1&amp;login=bobbyjason&amp;apiKey=MYLONG_BIT_LY_API_KEY&amp;format=text&amp;longUrl='.$url);
	 return $this-&gt;snoopy-&gt;results;
	}</pre>
<p>I must say though; <a title="download tweetmyblog" href="http://www.tweetmyblog.com/?rid=12043" target="_blank">TweetMyBlog </a>is a great plugin by John Merrick and Sean Jordansen and you should install it.</p>
<p>If you wish to monetise your tweets from your blog, then the above edits are silly. It&#8217;s just personally I would rather not have the user taken to a 3rd party site.</p>
<p>TweetMyBlog also provides a feed of your Tweets as a Widget, so it really is great!</p>
<p><a title="download tweetmyblog" href="http://www.tweetmyblog.com/?rid=12043" target="_blank">Download TweetMyBlog now</a>!</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29&amp;bodytext=I%20used%20to%20use%20TwitterFeed%3B%20but%20recently%20it%27s%20been%20a%20real%20pain%20in%20the%20ass%20and%20not%20updating%20so%20I%20looked%20for%20an%20alternative.%0D%0A%0D%0ARoll%20on%20TweetMyBlog.%0D%0A%0D%0ATweetMyBlog%20is%20great%20for%20the%20simple%20fact%20that%20it%20is%20a%20WordPress%20plugin.%20It%27s%20also%20a%20small%20download%2C%20a" title="Digg"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29&amp;notes=I%20used%20to%20use%20TwitterFeed%3B%20but%20recently%20it%27s%20been%20a%20real%20pain%20in%20the%20ass%20and%20not%20updating%20so%20I%20looked%20for%20an%20alternative.%0D%0A%0D%0ARoll%20on%20TweetMyBlog.%0D%0A%0D%0ATweetMyBlog%20is%20great%20for%20the%20simple%20fact%20that%20it%20is%20a%20WordPress%20plugin.%20It%27s%20also%20a%20small%20download%2C%20a" title="del.icio.us"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;t=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="Facebook"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;h=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="NewsVine"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="Reddit"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="StumbleUpon"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29&amp;annotation=I%20used%20to%20use%20TwitterFeed%3B%20but%20recently%20it%27s%20been%20a%20real%20pain%20in%20the%20ass%20and%20not%20updating%20so%20I%20looked%20for%20an%20alternative.%0D%0A%0D%0ARoll%20on%20TweetMyBlog.%0D%0A%0D%0ATweetMyBlog%20is%20great%20for%20the%20simple%20fact%20that%20it%20is%20a%20WordPress%20plugin.%20It%27s%20also%20a%20small%20download%2C%20a" title="Google Bookmarks"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;submitHeadline=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29&amp;submitSummary=I%20used%20to%20use%20TwitterFeed%3B%20but%20recently%20it%27s%20been%20a%20real%20pain%20in%20the%20ass%20and%20not%20updating%20so%20I%20looked%20for%20an%20alternative.%0D%0A%0D%0ARoll%20on%20TweetMyBlog.%0D%0A%0D%0ATweetMyBlog%20is%20great%20for%20the%20simple%20fact%20that%20it%20is%20a%20WordPress%20plugin.%20It%27s%20also%20a%20small%20download%2C%20a&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29%20-%20http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F" title="Twitter"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F" title="Technorati"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="Live"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;title=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29&amp;source=Internet+Marketing+-+Bobby+Jason+Internet+Marketing+From+a+Web+Developer&amp;summary=I%20used%20to%20use%20TwitterFeed%3B%20but%20recently%20it%27s%20been%20a%20real%20pain%20in%20the%20ass%20and%20not%20updating%20so%20I%20looked%20for%20an%20alternative.%0D%0A%0D%0ARoll%20on%20TweetMyBlog.%0D%0A%0D%0ATweetMyBlog%20is%20great%20for%20the%20simple%20fact%20that%20it%20is%20a%20WordPress%20plugin.%20It%27s%20also%20a%20small%20download%2C%20a" title="LinkedIn"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;t=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29" title="MySpace"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
</ul>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Fbobbyjason.co.uk%2Fblog%2F64%2Fhacking-tweetmyblog-twitterfeed-sucks%2F&amp;linkname=Hacking%20TweetMyBlog%20%28TwitterFeed%20Sucks%29"><img src="http://bobbyjason.co.uk/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Save/Bookmark"/></a>

<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bobbyjason.co.uk/blog/64/hacking-tweetmyblog-twitterfeed-sucks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.267 seconds -->

