<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Javacoffee Code</title><link>http://javacoffee.de</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/JavacoffeeCoding" /><description>All about code, open source, software, hacking and administration.</description><language>en</language><lastBuildDate>Thu, 19 Aug 2010 09:19:08 PDT</lastBuildDate><generator>http://wordpress.org/?v=2.9.2</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/JavacoffeeCoding" /><feedburner:info uri="javacoffeecoding" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><feedburner:emailServiceId>JavacoffeeCoding</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>“404 – File not found” vs. META tag noindex</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/PCq3Za6RHVk/</link><category>Internet</category><category>SEO</category><category>Webmaster</category><category>404</category><category>error</category><category>index</category><category>meta</category><category>nofollow</category><category>noindex</category><category>webmaster</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Thu, 19 Aug 2010 09:19:08 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=508</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D508"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D508&amp;style=normal&amp;hashtags=404,error,index,meta,nofollow,noindex,SEO,webmaster" height="61" width="50" /><br />
			</a>
		</div>
<p>Many web pages include a site search these days, that makes it possible for users to search content exactly on the page they are and not on the whole web, but what should one do, if no results were found?</p>
<p>Normally search engines would also index these pages, because they can’t see, that there is no result and we set the status to 200 which means “Okay, page found”. To prevent that, some webmasters use a “404 &#8211; File not found” header, so that the search engines would not index the page, but there are some major issues with that:</p>
<ol>
<li><strong>A 404 should <span style="text-decoration: underline;">only</span> be used for a page, that is not found.</strong> In the case of a search page with no results, a 404 would simply be wrong, because we show a page with content, only one with less content, than the user wanted.</li>
<li><strong>Links on 404 pages are lost. </strong>If the search engine bot finds a 404, all the content will not be fetched and all the links on that page (e.g. our result page with no results) would not be followed or indexed, so you loose a whole lot of link juice and maybe prevent indexing links, that can only be found on that particular page.</li>
</ol>
<p>Okay, now that we know a 404 is bad, what should we do instead? Well, that’s easy, if you remember the META-Tags, because there we have the META robots tag, that lets us set the parameters “nofollow” and “noindex” and the last one is exactly what we need!</p>
<p>So, if you want a page not being indexed by Google, but all the links on the page should be followed, you should set the following in the head section of your page:</p>
<p>&lt;META NAME=”ROBOTS” CONTENT=”NOINDEX,FOLLOW&#8221;&gt;</p>
<p>This would prevent search engines from indexing the page, but no link juice or links get lost!<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=336" rel="bookmark" title="27. May 2010">The value of Google result positioning</a></li>
<li><a href="http://javacoffee.de/?p=436" rel="bookmark" title="18. July 2010">Use Google Suggest as a helper for keyword research</a></li>
<li><a href="http://javacoffee.de/?p=361" rel="bookmark" title="30. May 2010">Actual Google and Twitter trends in a fancy newsticker for your page</a></li>
<li><a href="http://javacoffee.de/?p=404" rel="bookmark" title="12. June 2010">Benny the game (more or less) alive again!</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
</ul>
<p><!-- Similar Posts took 3.195 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=508&amp;t=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex+-+http://tinyurl.com/24xpnsk&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=508&amp;title=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=508&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=508&amp;title=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=508&amp;title=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=508&amp;title=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=508&amp;n=%E2%80%9C404+-+File+not+found%E2%80%9D+vs.+META+tag+noindex&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/PCq3Za6RHVk" height="1" width="1"/>]]></content:encoded><description>Many web pages include a site search these days, that makes it possible for users to search content exactly on the page they are and not on the whole web, but what should one do, if no results were found?
Normally search engines would also index these pages, because they can’t see, that there is no result and we set the status to 200 which means “Okay, page found”. To prevent that, some webmasters use a “404 &amp;#8211; File not found” header, so that the search engines would not index the ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=508</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=508</feedburner:origLink></item><item><title>Code snippet: Export simplenews subscribers from drupal to CSV</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/yW-Z5h1_ZmQ/</link><category>Code Snippets</category><category>Drupal</category><category>Internet</category><category>PHP</category><category>Programming</category><category>Webmaster</category><category>easy</category><category>email</category><category>export</category><category>helper</category><category>newsletter</category><category>php</category><category>script</category><category>simplenews</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Mon, 02 Aug 2010 12:59:48 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=497</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D497"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D497&amp;style=normal&amp;hashtags=Drupal,easy,email,export,helper,newsletter,php,script,simplenews" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://javacoffee.de/wp-content/2010/08/drupal_logo.jpg" rel="lightbox[497]"><img class="alignleft size-medium wp-image-499" title="Drupal Logo" src="http://javacoffee.de/wp-content/2010/08/drupal_logo-261x300.jpg" alt="Drupal Logo" width="157" height="180" /></a>Some of you may know the newsletter module <a rel="nofollow" href="http://drupal.org/project/simplenews" target="_blank">simplenews</a> for <a rel="nofollow" href="http://drupal.org" target="_blank">drupal</a>. If you&#8217;ve ever tried it, I am sure you soon realized, it&#8217;s a mess. The template functionality is too complicated and poor, emails are send via cron, you have no statistics and only poor ones with other extending modules&#8230;</p>
<p>Because of that, I think many people will change the newsletter system and maybe outsource it, so that you have to export your existing simplenews subcribers with username and some more data, than just the email address. Unfortunately there is no functionality for that build in  and so I wrote some tiny PHP (yes, I know &#8211; again! But the server did not support ruby, so there was no choice) script for doing that job.  From the simplenews module you can only export a CSV list of all the email addresses, that subscribed, but will not get any further user information, if the user comes from your community.</p>
<p>Here&#8217;s a script that takes the exported CSV and fetches the user name from the table, to write everything in another CSV file. With some easy modifications you can extend the script for fetching more data or not writing a second file &#8211; for me this was enough.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SQL_USER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// fill in your SQL user name</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SQL_PASS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// fill in your SQL password</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SQL_SERV'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SQL_DB'</span><span style="color: #339933;">,</span>   <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// fill in your drupal SQL database </span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// SQL connection</span>
  <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span>SQL_SERV<span style="color: #339933;">,</span> SQL_USER<span style="color: #339933;">,</span> SQL_PASS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$link</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">||</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span>SQL_DB<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Read in existing mail addresses</span>
  <span style="color: #000088;">$csvData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$fd</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mails.csv'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$data</span><span style="color: #339933;">=</span><span style="color: #990000;">fgetcsv</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fd</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$csvData</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Process the data and try to find a username in the database</span>
  <span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$csvData</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$data</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT `name` FROM `users` WHERE `mail`='<span style="color: #006699; font-weight: bold;">$data</span>'&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_result</span><span style="color: #009900;">&#40;</span><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><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$data</span>,,<span style="color: #006699; font-weight: bold;">$name</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$fd</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'output.csv'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w+'</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;">$fd</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</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;">$fd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Close SQL connection</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$link</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The mail addresses should be exported to a file named &#8220;mail.csv&#8221; or you have to change the file name in the code (line 16). After exporting the simplenews addresses and running the script you should find a file called &#8220;output.csv&#8221; in the execution directory of the script.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
<li><a href="http://javacoffee.de/?p=436" rel="bookmark" title="18. July 2010">Use Google Suggest as a helper for keyword research</a></li>
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
<li><a href="http://javacoffee.de/?p=48" rel="bookmark" title="11. March 2009">Problems with Pidgin and ICQ (Linux) ?</a></li>
<li><a href="http://javacoffee.de/?p=361" rel="bookmark" title="30. May 2010">Actual Google and Twitter trends in a fancy newsticker for your page</a></li>
</ul>
<p><!-- Similar Posts took 3.401 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=497&amp;t=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV+-+http://tinyurl.com/2udbko6&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=497&amp;title=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=497&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=497&amp;title=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=497&amp;title=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=497&amp;title=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=497&amp;n=Code+snippet%3A+Export+simplenews+subscribers+from+drupal+to+CSV&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/yW-Z5h1_ZmQ" height="1" width="1"/>]]></content:encoded><description>Some of you may know the newsletter module simplenews for drupal. If you&amp;#8217;ve ever tried it, I am sure you soon realized, it&amp;#8217;s a mess. The template functionality is too complicated and poor, emails are send via cron, you have no statistics and only poor ones with other extending modules&amp;#8230;
Because of that, I think many people will change the newsletter system and maybe outsource it, so that you have to export your existing simplenews subcribers with username and some more data, than just the email address. Unfortunately there is no ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=497</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments><feedburner:origLink>http://javacoffee.de/?p=497</feedburner:origLink></item><item><title>Day two of Ruby programming: (For now) It’s fun…</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/kcUljpM0B6Q/</link><category>Internet</category><category>Programming</category><category>Ruby</category><category>code</category><category>day two</category><category>resume</category><category>review</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Sun, 25 Jul 2010 08:14:42 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=449</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D449"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D449&amp;style=normal&amp;hashtags=code,day+two,Programming,resume,review,Ruby" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://javacoffee.de/wp-content/2010/07/Bloch-SermonOnTheMount.jpg" rel="lightbox[449]"><img class="alignleft size-medium wp-image-455" title="Bloch-SermonOnTheMount" src="http://javacoffee.de/wp-content/2010/07/Bloch-SermonOnTheMount-268x300.jpg" alt="" width="150" height="168" /></a>Day two of getting more into Ruby programming and I must say: <strong>Ruby can be fun!</strong> Okay, a few people seem to be really mad about it and see the language as an answer to everything, but I think there are some advantages to other languages, especially when it comes to string manipulation, iteration or string masking, but every language has its pros and cons.<span id="more-449"></span></p>
<p>Some programmers may say now, that there is nothing you can do in Ruby, you can&#8217;t do in another language and they&#8217;re right, but Ruby is clean, slim and really easy to read (if you know the syntax). The execution time of programs is almost similar to PHP programs with the same code and when it comes to huge amounts of data, PHP easily runs out of memory and you have to tweak the php.ini, whereas Ruby is running nice and smoothly.</p>
<p>It&#8217;s just nice when you can do things like</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">huge_array.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>item<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Item: #{item}&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>to iterate an array and print out the content or</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">link = <span style="color:#996600;">'http://example.com/somedir/somepost.php'</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;URL: #{#{URI.parse(link).host}&quot;</span></pre></div></div>

<p>to parse a string for a URL and just print out the hostname, done directly in the print statement.</p>
<p>But I also encountered some disadvantages of the language and facts against it:</p>
<ol>
<li>The amount of CPU and memory usage is much higher compared to PHP or Python and the runtime is almost similar, sometimes even slower.</li>
<li>The syntax is unusual, if you come from languages like Java, C/C++ or PHP, where the syntax is more or less similar.</li>
<li>Ruby is not spread as widely as PHP or Python are, which makes it hard for a business to make it the language of choice.</li>
</ol>
<p>For now I think Ruby is a beautiful language which is fun to write, but it&#8217;s useless for business or complex applications. There are advantages, but they are not big enough to make you switch completely to Ruby. Most of the things can also be done in PHP or Python with not that much more effort or code &#8211; or fun&#8230;</p>
<p>Using Ruby or not is maybe more a matter of taste and available hardware resources, than of what you want to do with your code.</p>
<p>P.S. Some code will follow soon&#8230; <img src='http://javacoffee.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>~ Image sources:</p>
<p><a title="Die Bergpredigt Jesu. Bild von Carl Bloch" href="http://upload.wikimedia.org/wikipedia/commons/9/96/Bloch-SermonOnTheMount.jpg" target="_blank" rel="lightbox[449]">Die Bergpredigt Jesu. Bild von Carl Bloch</a></p>
<p><a title="Offizielles Logo" href="http://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Ruby_logo.svg/200px-Ruby_logo.svg.png" target="_blank" rel="lightbox[449]">http://de.wikipedia.org/wiki/Ruby_(Programmiersprache)<br />
</a><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=436" rel="bookmark" title="18. July 2010">Use Google Suggest as a helper for keyword research</a></li>
<li><a href="http://javacoffee.de/?p=440" rel="bookmark" title="24. July 2010">Making a HTTP GET request with ruby</a></li>
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
<li><a href="http://javacoffee.de/?p=3" rel="bookmark" title="1. November 2008">YAPW (Yet another python webserver), version 0.0.1a realease!</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
</ul>
<p><!-- Similar Posts took 3.991 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=449&amp;t=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun..." rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun...+-+http://tinyurl.com/3666ctk&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=449&amp;title=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun..." rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=449&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=449&amp;title=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun..." rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=449&amp;title=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun..." rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=449&amp;title=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun..." rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=449&amp;n=Day+two+of+Ruby+programming%3A+%28For+now%29+It%27s+fun...&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/kcUljpM0B6Q" height="1" width="1"/>]]></content:encoded><description>Day two of getting more into Ruby programming and I must say: Ruby can be fun! Okay, a few people seem to be really mad about it and see the language as an answer to everything, but I think there are some advantages to other languages, especially when it comes to string manipulation, iteration or string masking, but every language has its pros and cons.
Some programmers may say now, that there is nothing you can do in Ruby, you can&amp;#8217;t do in another language and they&amp;#8217;re right, but Ruby is ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=449</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=449</feedburner:origLink></item><item><title>Making a HTTP GET request with ruby</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/6Y1fUcVXs7w/</link><category>Internet</category><category>Programming</category><category>Ruby</category><category>code</category><category>example</category><category>get</category><category>http</category><category>http request</category><category>simple</category><category>tutorial</category><category>twitter</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Sat, 24 Jul 2010 05:36:06 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=440</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D440"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D440&amp;style=normal&amp;hashtags=code,example,get,http,http+request,Internet,Ruby,simple,tutorial,twitter" height="61" width="50" /><br />
			</a>
		</div>
<p>I had to get into some <a title="Ruby programming language" href="http://www.ruby-lang.org/de/" target="_blank">ruby</a> programming for my job and so I decided to refresh my memories a bit more. It became more or less a tradition of mine to write some network or internet code to get into a language and so here&#8217;s a first result.</p>
<p>It&#8217;s just a simple function for making a HTTP request on a given target. On success it returns an HTTP object, on error nil. It&#8217;s nothing fancy, but it should be reliable and maybe helps someone for his/her project&#8230;</p>
<p><span id="more-440"></span></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'net/http'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'uri'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'json'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Simple HTTP GET request function</span>
<span style="color:#9966CC; font-weight:bold;">def</span> makeRequest<span style="color:#006600; font-weight:bold;">&#40;</span>target=<span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> target == <span style="color:#996600;">''</span> <span style="color:#006600; font-weight:bold;">||</span> target == <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      url = <span style="color:#CC00FF; font-weight:bold;">URI</span>.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>target<span style="color:#006600; font-weight:bold;">&#41;</span>
      req = <span style="color:#6666ff; font-weight:bold;">Net::HTTP::Get</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>target<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">begin</span>
    res = <span style="color:#6666ff; font-weight:bold;">Net::HTTP</span>.<span style="color:#9900CC;">start</span><span style="color:#006600; font-weight:bold;">&#40;</span>url.<span style="color:#9900CC;">host</span>, url.<span style="color:#9900CC;">port</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>http<span style="color:#006600; font-weight:bold;">|</span> http.<span style="color:#9900CC;">request</span><span style="color:#006600; font-weight:bold;">&#40;</span>req<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">rescue</span>
    res = <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> res
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>A possible usage of the code could be:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">target = <span style="color:#996600;">'http://search.twitter.com/trends/current.json'</span>
out = makeRequest<span style="color:#006600; font-weight:bold;">&#40;</span>target<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#996600;">'Error!'</span>;
json = JSON.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>out.<span style="color:#9900CC;">body</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>val<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> val<span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> json</pre></div></div>

<p>This code fetches the current trending topics from <a title="Twitter" href="http://twitter.com" target="_blank">twitter</a> in JSON format.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=436" rel="bookmark" title="18. July 2010">Use Google Suggest as a helper for keyword research</a></li>
<li><a href="http://javacoffee.de/?p=9" rel="bookmark" title="21. November 2008">Chat Server in C &#8211; Windows port</a></li>
<li><a href="http://javacoffee.de/?p=449" rel="bookmark" title="25. July 2010">Day two of Ruby programming: (For now) It&#8217;s fun&#8230;</a></li>
<li><a href="http://javacoffee.de/?p=258" rel="bookmark" title="21. March 2010">First steps into Drupal: iTweet Twitter Module</a></li>
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
</ul>
<p><!-- Similar Posts took 3.101 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=440&amp;t=Making+a+HTTP+GET+request+with+ruby" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Making+a+HTTP+GET+request+with+ruby+-+http://tinyurl.com/2dr62t3&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=440&amp;title=Making+a+HTTP+GET+request+with+ruby" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=440&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=440&amp;title=Making+a+HTTP+GET+request+with+ruby" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=440&amp;title=Making+a+HTTP+GET+request+with+ruby" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=440&amp;title=Making+a+HTTP+GET+request+with+ruby" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=440&amp;n=Making+a+HTTP+GET+request+with+ruby&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/6Y1fUcVXs7w" height="1" width="1"/>]]></content:encoded><description>I had to get into some ruby programming for my job and so I decided to refresh my memories a bit more. It became more or less a tradition of mine to write some network or internet code to get into a language and so here&amp;#8217;s a first result.
It&amp;#8217;s just a simple function for making a HTTP request on a given target. On success it returns an HTTP object, on error nil. It&amp;#8217;s nothing fancy, but it should be reliable and maybe helps someone for his/her project&amp;#8230;


require 'net/http'
require 'uri'
require 'json'
&amp;#160;
# ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=440</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://javacoffee.de/?p=440</feedburner:origLink></item><item><title>Use Google Suggest as a helper for keyword research</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/G27_14l57IE/</link><category>Code Snippets</category><category>Internet</category><category>PHP</category><category>Programming</category><category>SEO</category><category>Webmaster</category><category>class</category><category>code</category><category>google</category><category>helper</category><category>keyword</category><category>keyword research</category><category>php</category><category>suggest</category><category>use</category><category>utility</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Sun, 18 Jul 2010 10:30:50 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=436</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D436"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D436&amp;style=normal&amp;hashtags=class,code,google,helper,keyword,keyword+research,php,suggest,use,utility" height="61" width="50" /><br />
			</a>
		</div>
<div class="wp-caption alignright" style="width: 233px"><a href="http://infopirat.com/"></p>
<p><img class=" " title="Google Suggest in action" src="http://infopirat.com/files/google-suggest.png" alt="" width="223" height="176" /></p>
<p></a><p class="wp-caption-text">Image from: http://infopirat.com/</p></div>
<p>Since April 2009 Google offers some nice feature in web search called Suggest, which is the  list of search queries you see,when you type in some search query into Google. I think everyone knows and uses it&#8230;</p>
<p>In addition to this nice helper on the website itself, Google also provides the same results as a feed or javascript code, which made me think of some way to utilize it and it seems to be a perfect helper for <strong>keyword research</strong> issues. The magical URL  is: <a href="http://www.google.com/complete/search?hl=de&amp;html=true&amp;qu=abnehmen">http://www.google.com/complete/search</a> with its parameters.</p>
<p><span style="text-decoration: underline;">Parameters are:</span></p>
<ol>
<li><strong>hl</strong>: string value which determines the language (e.g. &#8216;de&#8217;, &#8216;en&#8217;, &#8216;jp&#8217;&#8230;)</li>
<li>The format to fetch. For my code I use the XML output, but possible values are:
<ul>
<li><strong>xml=true </strong>
<p>Returns the results in XML format.</p>
</li>
<li><strong>js=true</strong>
<p>Returns some javascript code with the results to embed.</p>
</li>
<li><strong>json=true</strong>
<p>Returns the results in JSON format</p>
</li>
</ul>
</li>
<li><strong>qu</strong>: the query to look for.</li>
</ol>
<p>A valid complete URL would look like: <a href="http://www.google.com/complete/search?hl=de&amp;xml=true&amp;qu=javacoffee">http://www.google.com/complete/search?hl=de&amp;xml=true&amp;qu=javacoffee</a></p>
<p>So, how to use this in keyword reasearch? Well, the point is, that users often take the suggestions Google gives, so it could be worth to rank hight for that keyword combinations.</p>
<p>I wrote come simple class in PHP, that let&#8217;s you easily utilize the suggestion feed:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SUGGEST_URL'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://www.google.com/complete/search?hl=@COUNTRY@&amp;xml=true&amp;qu=@QUERY@'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
     * A simple class, that only contains one function to fetch the 10 
     * suggestions for a specific query and language from google and return them 
     * in a two dimensional array.
     * The structure of the array is:
     *     (string) $Element['suggestion']
     *     (int)    $Element['results']
     * The first element contains the the suggestion string, the second one
     * holds the count of search results for that query.
     *
     * On error this function returns a negative error code.
     * Error codes are:
     *    (-1): Parameter not set
     *    (-2): Cannot load data from query url
     *    (-3): XML loading failed
     */</span>
  <span style="color: #000000; font-weight: bold;">class</span> gSuggest <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getSuggestData<span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</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: #666666; font-style: italic;">// Check parameters </span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$lang</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$query</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: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #666666; font-style: italic;">// Create query url</span>
      <span style="color: #000088;">$queryUrl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@COUNTRY@'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'@QUERY@'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
                              <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> SUGGEST_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>       
      <span style="color: #666666; font-style: italic;">// Fetch XML from google</span>
      <span style="color: #000088;">$suggestFeed</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$queryUrl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$suggestFeed</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #666666; font-style: italic;">// Load XML data into object</span>
      <span style="color: #000088;">$xmlData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">simplexml_load_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$suggestFeed</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$xmlData</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #666666; font-style: italic;">// Process the XML object</span>
      <span style="color: #000088;">$returnData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlData</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CompleteSuggestion</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$s_data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">suggestion</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$n_data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_queries</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>        
        <span style="color: #000088;">$returnData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'suggestion'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$s_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'data'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$returnData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'results'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$n_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'int'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$index</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$returnData</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The class only contains one public function and no constructor, so as an usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php   
  <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gSuggest.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> gSuggest<span style="color: #339933;">::</span><span style="color: #004000;">getSuggestData</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'argv'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'abnehmen'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(<span style="color: #009933; font-weight: bold;">%d</span>) <span style="color: #009933; font-weight: bold;">%s</span> =&gt; <span style="color: #009933; font-weight: bold;">%d</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</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: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'suggestion'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'results'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This would look for the term &#8220;javacoffee&#8221; in english (en) language and print the resulting array.</p>
<p>    <strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
<li><a href="http://javacoffee.de/?p=440" rel="bookmark" title="24. July 2010">Making a HTTP GET request with ruby</a></li>
<li><a href="http://javacoffee.de/?p=508" rel="bookmark" title="19. August 2010">“404 &#8211; File not found” vs. META tag noindex</a></li>
<li><a href="http://javacoffee.de/?p=497" rel="bookmark" title="2. August 2010">Code snippet: Export simplenews subscribers from drupal to CSV</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
</ul>
<p><!-- Similar Posts took 3.582 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=436&amp;t=Use+Google+Suggest+as+a+helper+for+keyword+research" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Use+Google+Suggest+as+a+helper+for+keyword+research+-+http://tinyurl.com/32mhzt7&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=436&amp;title=Use+Google+Suggest+as+a+helper+for+keyword+research" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=436&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=436&amp;title=Use+Google+Suggest+as+a+helper+for+keyword+research" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=436&amp;title=Use+Google+Suggest+as+a+helper+for+keyword+research" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=436&amp;title=Use+Google+Suggest+as+a+helper+for+keyword+research" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=436&amp;n=Use+Google+Suggest+as+a+helper+for+keyword+research&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/G27_14l57IE" height="1" width="1"/>]]></content:encoded><description>Since April 2009 Google offers some nice feature in web search called Suggest, which is the  list of search queries you see,when you type in some search query into Google. I think everyone knows and uses it&amp;#8230;
In addition to this nice helper on the website itself, Google also provides the same results as a feed or javascript code, which made me think of some way to utilize it and it seems to be a perfect helper for keyword research issues. The magical URL  is: http://www.google.com/complete/search with its parameters.
Parameters are:

hl: string value which determines ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=436</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=436</feedburner:origLink></item><item><title>Benny the game (more or less) alive again!</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/FuwnMdSkghk/</link><category>C++</category><category>Programming</category><category>Stuff</category><category>basic</category><category>benny</category><category>code</category><category>first</category><category>game</category><category>project</category><category>worst</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Sat, 12 Jun 2010 12:30:29 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=404</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D404"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D404&amp;style=normal&amp;hashtags=basic,benny,C%2B%2B,code,first,game,project,worst" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://javacoffee.de/wp-content/2010/06/Benny-Screen-01.png" rel="lightbox[404]"><img class="alignleft" title="Benny Screen 01" src="http://javacoffee.de/wp-content/2010/06/Benny-Screen-01-300x225.png" alt="Screenshot of Benny the game" width="216" height="162" /></a>Maybe it&#8217;s the worst code I have ever written, but it was also my very first project in C++ and lost for years, because of my stupidity. Now, about four years later, <a title="http://youtube.com/user/sirrascor" href="http://youtube.com/user/sirrascor" target="_blank">rasco</a> found an old copy of the source on some backup DVD and made the code and game alive again&#8230;</p>
<p><span id="more-404"></span>But first a bit about the history of Benny: After doing some C programming and for getting into C++, I decided to write a game. It was the remake of a game I wrote several years ago in basic: Benny the game. In Benny the player controls a fly called Benny, that had to escape a bad smiley and catch apples to reach the next level. The first version in Basic already included five levels with different difficulties and some kind of story.</p>
<p>The C++ version was never finished and included only one level, but some extras the first version never had, like health packages and multiple enemies. As I mentioned before, the code was really ugly and after doing some long break, I realized that this piece of shit is not maintainable or expandable and so I stopped the development and deleted the code.</p>
<p>I still regret that decision, but fortunately rasco was part of the development and found some old code. It was a strange, but happy feeling to see that code again after such a long time and the believe, that it&#8217;s lost forever, but it was also horrible, too. I remembered how ugly and hard to maintain it was, but after trying to compile it on windows, I also remembered how hard it was to make it run. I only made it run on a linux machine with some editing of the code and makefile.</p>
<p>Here&#8217;s some footage I made:<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/1fL2fEvxt7Y&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1fL2fEvxt7Y&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>If you want to build Benny on your own, have a look at the <a title="Google Code Project page of the backlink checker" href="http://code.google.com/p/benny-the-game/" target="_blank">Google Code project page</a> I made. On a linux machine it&#8217;s possible, but a pain in the ass and on Windows: good luck!</p>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=208" rel="bookmark" title="29. January 2010">3T: Text based Tic Tac Toe</a></li>
<li><a href="http://javacoffee.de/?p=5" rel="bookmark" title="1. November 2008">YAPW Windows update</a></li>
<li><a href="http://javacoffee.de/?p=3" rel="bookmark" title="1. November 2008">YAPW (Yet another python webserver), version 0.0.1a realease!</a></li>
<li><a href="http://javacoffee.de/?p=220" rel="bookmark" title="3. February 2010">3T Update: Version 1.0</a></li>
<li><a href="http://javacoffee.de/?p=508" rel="bookmark" title="19. August 2010">“404 &#8211; File not found” vs. META tag noindex</a></li>
</ul>
<p><!-- Similar Posts took 3.082 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=404&amp;t=Benny+the+game+%28more+or+less%29+alive+again%21" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Benny+the+game+%28more+or+less%29+alive+again%21+-+http://tinyurl.com/39zgw9d&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=404&amp;title=Benny+the+game+%28more+or+less%29+alive+again%21" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=404&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=404&amp;title=Benny+the+game+%28more+or+less%29+alive+again%21" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=404&amp;title=Benny+the+game+%28more+or+less%29+alive+again%21" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=404&amp;title=Benny+the+game+%28more+or+less%29+alive+again%21" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=404&amp;n=Benny+the+game+%28more+or+less%29+alive+again%21&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/FuwnMdSkghk" height="1" width="1"/>]]></content:encoded><description>Maybe it&amp;#8217;s the worst code I have ever written, but it was also my very first project in C++ and lost for years, because of my stupidity. Now, about four years later, rasco found an old copy of the source on some backup DVD and made the code and game alive again&amp;#8230;
But first a bit about the history of Benny: After doing some C programming and for getting into C++, I decided to write a game. It was the remake of a game I wrote several years ago in basic: Benny ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=404</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=404</feedburner:origLink></item><item><title>Redirect without editing .htaccess file</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/jdC02VzQLg8/</link><category>Internet</category><category>PHP</category><category>SEO</category><category>Webmaster</category><category>301</category><category>302</category><category>header</category><category>htaccess</category><category>php</category><category>redirect</category><category>script</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Wed, 02 Jun 2010 14:52:39 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=395</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D395"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D395&amp;style=normal&amp;hashtags=301,302,header,htaccess,php,redirect,script" height="61" width="50" /><br />
			</a>
		</div>
<p>You need to do a 301 or 302 redirect, but have no access to the server configuration files or the .htaccess file? Unfortunately not all hosters allow you to edit the .htaccess file, where you could easily set a redirect via the line:</p>
<p>Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]</p>
<p>I recently had exactly that problem, but PHP has some nice function, that helped me out: <a title="Header function on php.net" href="http://de2.php.net/manual/en/function.header.php" target="_blank">header()</a>. The function allows you to send a raw HTTP header to the client browser. A 301 or 302 redirect is stored in the header section and so we can set our redirect without ever touching the .htaccess:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php 
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HTTP/1.1 301 Moved Permanently&quot;</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;">&quot;Location: http://YOURDOMAIN.COM&quot;</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;">&quot;Connection: close&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>All you have to do is paste that code into the index file on the domain you want to make the redirect from and edit the line that specifies the location with your URL and maybe the redirect itself (e.g. for a 302, etc)  &#8211; that&#8217;s it, now you have your redirect!<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=508" rel="bookmark" title="19. August 2010">“404 &#8211; File not found” vs. META tag noindex</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
<li><a href="http://javacoffee.de/?p=361" rel="bookmark" title="30. May 2010">Actual Google and Twitter trends in a fancy newsticker for your page</a></li>
<li><a href="http://javacoffee.de/?p=3" rel="bookmark" title="1. November 2008">YAPW (Yet another python webserver), version 0.0.1a realease!</a></li>
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
</ul>
<p><!-- Similar Posts took 3.844 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=395&amp;t=Redirect+without+editing+.htaccess+file" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Redirect+without+editing+.htaccess+file+-+http://tinyurl.com/22ocbra&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=395&amp;title=Redirect+without+editing+.htaccess+file" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=395&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=395&amp;title=Redirect+without+editing+.htaccess+file" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=395&amp;title=Redirect+without+editing+.htaccess+file" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=395&amp;title=Redirect+without+editing+.htaccess+file" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=395&amp;n=Redirect+without+editing+.htaccess+file&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/jdC02VzQLg8" height="1" width="1"/>]]></content:encoded><description>You need to do a 301 or 302 redirect, but have no access to the server configuration files or the .htaccess file? Unfortunately not all hosters allow you to edit the .htaccess file, where you could easily set a redirect via the line:
Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]
I recently had exactly that problem, but PHP has some nice function, that helped me out: header(). The function allows you to send a raw HTTP header to the client browser. A 301 or 302 redirect is stored in the header section and so we can ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=395</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=395</feedburner:origLink></item><item><title>Script for basic Wordpress installation, with plugins and themes</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/nahpAo4QEJg/</link><category>PHP</category><category>Programming</category><category>automatic</category><category>php</category><category>script</category><category>simple</category><category>wordpress installation</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Wed, 02 Jun 2010 13:42:45 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=379</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D379"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D379&amp;style=normal&amp;hashtags=automatic,php,script,simple,wordpress+installation" height="61" width="50" /><br />
			</a>
		</div>
<p>For my work I had to make several <a title="Official Wordpress Site" href="http://wordpress.org" target="_blank" rel="nofollow">wordpress</a> installations with the same basic plugins and themes over and over again. Maybe you know that pain in the ass, but I got sick of downloading and extracting all the stuff manually, so I decided to write some handy script to do the job for me.</p>
<p>Within the script you can extend the list of plugins and themes to be downloaded, to fit your custom purposes.<br />
<strong>Important:</strong> If new versions of plugins are available you have to edit the URLs in the array! Make sure, that all URLs lead to the actual version, when using the script.<br />
<span id="more-379"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
	<span style="color: #009933; font-style: italic;">/**
	* PHP script to fetch a basic and actual wordpress installation
	* to a directory name of your choice and some basic plugins and 
	* themes in an extendable list. The result will be a directory 
	* in the root directory of this script.
	* To add more plugins, simply extend the $plugins array below with
	* the URL to the plugins you chose.
	*
	* Usage: php wordpress-install.php [&lt;destination name&gt;]
	*
	* The destination name is optional. If none is given, the output
	* directory will be called &quot;wordpress&quot;.
	* 
	* NOTE: The script is most useful, if you run it directly on the 
	* 	 server you want to install wordpress. If this is not 
	*	 possible(e.g. your hoster does not allow remote file 
	* 	 access, etc.), you can run it locally and upload the 
	* 	 resulting folder to the destination of your choice.
	*
	* IMPORTANT: Check the actuality of the plugin URL's and update them,
	* 	      if a new version is released!
	* 
	* Author: Martin Albrecht &lt;martin .albrecht@javacoffee.de&gt;
	* Homepage: http://javacoffee.de
	*/</span>
&nbsp;
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	* Simple function to fetch and extract a zip file, because all 
	* archives we'll download are ZIP files
	*
	* Parameters are the URL and flags, if it is a plugin or theme.
	*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> DownloadZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$theme</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$theme</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wordpress'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;[!] Error: No wordpress installation found!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		try <span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/.*\/.*\/(.*)/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;[+] Downloading <span style="color: #006699; font-weight: bold;">$filename</span>... &quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;DONE!<span style="color: #000099; font-weight: bold;">\n</span>[+] Unpacking <span style="color: #006699; font-weight: bold;">$filename</span>... &quot;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$zip</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ZipArchive<span style="color: #339933;">;</span>
				<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">open</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugin</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extractTo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wordpress/wp-content/plugins/'</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$theme</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extractTo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wordpress/wp-content/themes/'</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: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extractTo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
				<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;DONE!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#### SCRIPT EXECUTION BEGINS HERE ####
</span>
	<span style="color: #009933; font-style: italic;">/**
	* The plugins array. Here, you can simply add as much plugins as you want
	* by simply extending the array with the URLs to the plugin.
	*/</span>
	<span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/google-analytics-for-wordpress.3.2.5.zip'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/google-sitemap-generator.3.2.4.zip'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/wptouch.1.9.13.zip'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/statpress.zip'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/similar-posts.2.6.2.0.zip'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'http://downloads.wordpress.org/plugin/sexybookmarks.3.2.3.zip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	* The themes array. The structure is the same as the plugins array.
	*/</span>
	<span style="color: #000088;">$themes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://michaelhutagalung.com/downloads/ArthemiaFree'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// URL to the lates wordpress version</span>
	<span style="color: #000088;">$wordpress</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://wordpress.org/latest.zip'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Download and unzip files...</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Beginning download of wordpress with '</span><span style="color: #339933;">,</span><span style="color: #990000;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugins</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; plugins...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	DownloadZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wordpress</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugins</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		DownloadZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin</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>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$themes</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$theme</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		DownloadZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$theme</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</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: #666666; font-style: italic;">// Rename directory, if name is given	</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$argc</span><span style="color: #339933;">&gt;=</span><span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">rename</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wordpress'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'argv'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>martin<span style="color: #339933;">&gt;</span></pre></div></div>

<p>It&#8217;s a very simple PHP script, that only downloads and extracts wordpress, the chosen plugins and themes into a directory in the root directory of the script.<br />
If you don&#8217;t want to copy/paste the code, <span style="text-decoration: underline;"><strong>here&#8217;s a download link:</strong></span> <a href="http://javacoffee.de/wp-content/2010/06/wordpress-install.zip">wordpress-install</a><br />
<br />
<strong>Quick update:</strong> Of course, you need the PECL Zip library for PHP to use the ZipArchive class. See the <a href="http://de2.php.net/manual/en/class.ziparchive.php" rel="nofollow">official documentation</a> for more information.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=497" rel="bookmark" title="2. August 2010">Code snippet: Export simplenews subscribers from drupal to CSV</a></li>
<li><a href="http://javacoffee.de/?p=361" rel="bookmark" title="30. May 2010">Actual Google and Twitter trends in a fancy newsticker for your page</a></li>
<li><a href="http://javacoffee.de/?p=436" rel="bookmark" title="18. July 2010">Use Google Suggest as a helper for keyword research</a></li>
<li><a href="http://javacoffee.de/?p=48" rel="bookmark" title="11. March 2009">Problems with Pidgin and ICQ (Linux) ?</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
</ul>
<p><!-- Similar Posts took 3.938 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=379&amp;t=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes+-+http://tinyurl.com/2vzunzu&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=379&amp;title=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=379&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=379&amp;title=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=379&amp;title=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=379&amp;title=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=379&amp;n=Script+for+basic+Wordpress+installation%2C+with+plugins+and+themes&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/nahpAo4QEJg" height="1" width="1"/>]]></content:encoded><description>For my work I had to make several wordpress installations with the same basic plugins and themes over and over again. Maybe you know that pain in the ass, but I got sick of downloading and extracting all the stuff manually, so I decided to write some handy script to do the job for me.
Within the script you can extend the list of plugins and themes to be downloaded, to fit your custom purposes.
Important: If new versions of plugins are available you have to edit the URLs in the array! ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=379</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://javacoffee.de/?p=379</feedburner:origLink></item><item><title>Actual Google and Twitter trends in a fancy newsticker for your page</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/HoB4UOHHcLw/</link><category>PHP</category><category>Programming</category><category>api</category><category>code</category><category>google trend</category><category>library</category><category>php</category><category>ticker</category><category>trend</category><category>twitter trend</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Sun, 30 May 2010 07:35:08 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=361</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D361"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D361&amp;style=normal&amp;hashtags=api,code,google+trend,library,php,ticker,trend,twitter+trend" height="61" width="50" /><br />
			</a>
		</div>
<p>Some days ago I posted an <a title="Get latest Trends from Google with some simple PHP script" href="http://javacoffee.de/?p=295" target="_blank">article</a> about fetching the actual hot trends from Google. Today, I wrote the <strong>TrendFetcher library</strong>, a simple PHP class/library, that gives you a nice jquery flavoured <strong>&#8220;trend ticker&#8221; </strong>with the latest hot trends from <a title="Hottrends from Google" href="http://google.de/trends/hottrends/atom/hourly" target="_blank">Google</a>, the actual trends from <a href="http://twitter.com" target="_blank">Twitter</a> and some API access.<span id="more-361"></span></p>
<p>All you need is to implement <a title="jquery javascript library" href="http://jquery.com" target="_blank">jQuery</a>, the <a title="jQuery newsticker" href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html" target="_blank">jQuery newsticker</a> and its <a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/li-scroller.css" target="_blank">styles</a> into your page. You can easily achieve that, when you add the following lines of code in your header section:</p>
<p><em>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://code.jquery.com/jquery-1.4.2.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/jquery.li-scroller.1.0.js&#8221;&gt;&lt;/script&gt;<br />
&lt;link rel=&#8221;Stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/li-scroller.css&#8221; /&gt;</em></p>
<p>After you&#8217;ve done that, you can implement the newsticker at any place in your body section:</p>
<p><em>&lt;?php echo file_get_contents(&#8216;http://webciv.net/tamtam/lab/api/api.php?c=TrendTicker&#8217;); ?&gt;</em></p>
<p><em><span style="font-style: normal;">In this example, we print out what the API returns. Until now there&#8217;s only one command supported by the API, but there&#8217;ll be maybe more in the future. Also the results only include the hottrends for <strong>the region USA</strong> from Google, because other locations are not yet supported as far as I know.</span></em></p>
<p><em><span style="font-style: normal;">To answer the question &#8220;why?&#8221;: It&#8217;s been created during some SEO research, but I found out that the idea is a nice gimmick, but worthless for SEO purposes&#8230;</span></em></p>
<p>See a demonstation: <a title="The outpost" href="http://webciv.net/tamtam/lab/outpost/" target="_blank">http://webciv.net/tamtam/lab/outpost/</a></p>
<p>Have fun!</p>
<address>Thumbnail photo taken from:<em> </em><a title="Edit “Newsticker from: http://www.flickr.com/photos/29487767@N02/4053393372/”" href="http://javacoffee.de/wp-admin/media.php?action=edit&amp;attachment_id=365"><em>http://www.flickr.com/photos/29487767@N02/4053393372/</em></a></address>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=295" rel="bookmark" title="23. May 2010">Get latest Hot-Trends from Google with some simple PHP script</a></li>
<li><a href="http://javacoffee.de/?p=379" rel="bookmark" title="2. June 2010">Script for basic Wordpress installation, with plugins and themes</a></li>
<li><a href="http://javacoffee.de/?p=111" rel="bookmark" title="10. January 2010">Track users where you normally can&#8217;t track users</a></li>
<li><a href="http://javacoffee.de/?p=508" rel="bookmark" title="19. August 2010">“404 &#8211; File not found” vs. META tag noindex</a></li>
<li><a href="http://javacoffee.de/?p=48" rel="bookmark" title="11. March 2009">Problems with Pidgin and ICQ (Linux) ?</a></li>
</ul>
<p><!-- Similar Posts took 3.479 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=361&amp;t=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page+-+http://tinyurl.com/378yj7b&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=361&amp;title=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=361&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=361&amp;title=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=361&amp;title=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=361&amp;title=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=361&amp;n=Actual+Google+and+Twitter+trends+in+a+fancy+newsticker+for+your+page&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/HoB4UOHHcLw" height="1" width="1"/>]]></content:encoded><description>Some days ago I posted an article about fetching the actual hot trends from Google. Today, I wrote the TrendFetcher library, a simple PHP class/library, that gives you a nice jquery flavoured &amp;#8220;trend ticker&amp;#8221; with the latest hot trends from Google, the actual trends from Twitter and some API access.
All you need is to implement jQuery, the jQuery newsticker and its styles into your page. You can easily achieve that, when you add the following lines of code in your header section:
&amp;#60;script type=&amp;#8221;text/javascript&amp;#8221; src=&amp;#8221;http://code.jquery.com/jquery-1.4.2.min.js&amp;#8221;&amp;#62;&amp;#60;/script&amp;#62;
&amp;#60;script type=&amp;#8221;text/javascript&amp;#8221; src=&amp;#8221;http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/jquery.li-scroller.1.0.js&amp;#8221;&amp;#62;&amp;#60;/script&amp;#62;
&amp;#60;link rel=&amp;#8221;Stylesheet&amp;#8221; type=&amp;#8221;text/css&amp;#8221; href=&amp;#8221;http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/li-scroller.css&amp;#8221; /&amp;#62;
After you&amp;#8217;ve done that, ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=361</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=361</feedburner:origLink></item><item><title>Ultimate Top 5 Nerdcore Songs</title><link>http://feedproxy.google.com/~r/JavacoffeeCoding/~3/Gh5X-Bs3rFc/</link><category>Nerdcore</category><category>Stuff</category><category>8 bit boys</category><category>dale chase</category><category>dual core</category><category>five</category><category>hip hop</category><category>hitlist</category><category>music</category><category>nerdcore</category><category>top</category><category>ytcracker</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">0xC0FF33</dc:creator><pubDate>Thu, 27 May 2010 12:48:22 PDT</pubDate><guid isPermaLink="false">http://javacoffee.de/?p=347</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D347"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjavacoffee.de%2F%3Fp%3D347&amp;style=normal&amp;hashtags=8+bit+boys,dale+chase,dual+core,five,hip+hop,hitlist,music,nerdcore,top,ytcracker" height="61" width="50" /><br />
			</a>
		</div>
<h2>1. YTCracker &#8211; Meganerd</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/tN12Tg5ttpk&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/tN12Tg5ttpk&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>2. Dale Chase &#8211; Coder Girl</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/B-m6JDYRFvk&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/B-m6JDYRFvk&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>3. YTCracker &#8211; Nerdlife</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/nHpUMgAGLtM&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/nHpUMgAGLtM&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>4. Dual Core &#8211; Forever</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/q4v1Z_4jBVo&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/q4v1Z_4jBVo&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>5. 8 Bit Boys</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/sCbR4E_Kc1M&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/sCbR4E_Kc1M&amp;hl=de_DE&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><span id="more-347"></span></p>
<p><strong><span style="text-decoration: underline;">Links:</span></strong></p>
<ul>
<li>Official YTCracker page: <a title="Official page ytcracker" href="http://ytcracker.com" target="_blank">http://ytcracker.com</a></li>
<li>Official Dale Chase page: <a title="Official page from Dale Chase" href="http://dalechase.com" target="_blank">http://dalechase.com</a></li>
<li>Official Dual Core page: <a title="Official Dual Core page" href="http://dualcoremusic.com/nerdcore/" target="_blank">http://dualcoremusic.com/nerdcore/</a></li>
<li>Official 8 Bit Boys page: <a title="Official 8 Bit Boys page" href="http://www.8bitboys.com/" target="_blank">http://www.8bitboys.com/</a></li>
</ul>
<address>Thumbnail Photo from: <a title="MTV site" href="http://multiplayerblog.mtv.com/2006/10/09/nerdcore/" target="_blank">http://multiplayerblog.mtv.com/2006/10/09/nerdcore/</a></address>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://javacoffee.de/?p=258" rel="bookmark" title="21. March 2010">First steps into Drupal: iTweet Twitter Module</a></li>
<li><a href="http://javacoffee.de/?p=361" rel="bookmark" title="30. May 2010">Actual Google and Twitter trends in a fancy newsticker for your page</a></li>
<li><a href="http://javacoffee.de/?p=508" rel="bookmark" title="19. August 2010">“404 &#8211; File not found” vs. META tag noindex</a></li>
<li><a href="http://javacoffee.de/?p=48" rel="bookmark" title="11. March 2009">Problems with Pidgin and ICQ (Linux) ?</a></li>
<li><a href="http://javacoffee.de/?p=404" rel="bookmark" title="12. June 2010">Benny the game (more or less) alive again!</a></li>
</ul>
<p><!-- Similar Posts took 2.989 ms --></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://javacoffee.de/?p=347&amp;t=Ultimate+Top+5+Nerdcore+Songs" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Ultimate+Top+5+Nerdcore+Songs+-+http://tinyurl.com/39grdrp&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://javacoffee.de/?p=347&amp;title=Ultimate+Top+5+Nerdcore+Songs" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://javacoffee.de/?p=347&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://javacoffee.de/?p=347&amp;title=Ultimate+Top+5+Nerdcore+Songs" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://javacoffee.de/?p=347&amp;title=Ultimate+Top+5+Nerdcore+Songs" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://javacoffee.de/?p=347&amp;title=Ultimate+Top+5+Nerdcore+Songs" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://javacoffee.de/?p=347&amp;n=Ultimate+Top+5+Nerdcore+Songs&amp;pli=1" rel="" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

<img src="http://feeds.feedburner.com/~r/JavacoffeeCoding/~4/Gh5X-Bs3rFc" height="1" width="1"/>]]></content:encoded><description>1. YTCracker &amp;#8211; Meganerd

2. Dale Chase &amp;#8211; Coder Girl

3. YTCracker &amp;#8211; Nerdlife

4. Dual Core &amp;#8211; Forever

5. 8 Bit Boys


Links:

Official YTCracker page: http://ytcracker.com
Official Dale Chase page: http://dalechase.com
Official Dual Core page: http://dualcoremusic.com/nerdcore/
Official 8 Bit Boys page: http://www.8bitboys.com/

Thumbnail Photo from: http://multiplayerblog.mtv.com/2006/10/09/nerdcore/
Similar Posts:

First steps into Drupal: iTweet Twitter Module
Actual Google and Twitter trends in a fancy newsticker for your page
“404 &amp;#8211; File not found” vs. META tag noindex
Problems with Pidgin and ICQ (Linux) ?
Benny the game (more or less) alive again!






		
			Share this on Facebook
		
		
			Tweet This!
		
		
			Digg this!
		
		
			Post on Google Buzz
		
		
			Add this to Google Bookmarks
		
		
			Share this on del.icio.us
		
		
			Stumble upon ...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://javacoffee.de/?feed=rss2&amp;p=347</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://javacoffee.de/?p=347</feedburner:origLink></item></channel></rss>
