<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Anthony Shapley &#187; PHP Archives  &#8211; Anthony Shapley</title>
	<atom:link href="http://www.anthonyshapley.co.uk/category/internet/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anthonyshapley.co.uk</link>
	<description>Search Engine Optimisation &#38; Pay Per Click</description>
	<lastBuildDate>Mon, 10 Oct 2011 07:46:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Fixing image paths in WordPress after moving hosts</title>
		<link>http://www.anthonyshapley.co.uk/fixing-image-paths-in-wordpress-after-moving-hosts/</link>
		<comments>http://www.anthonyshapley.co.uk/fixing-image-paths-in-wordpress-after-moving-hosts/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 08:46:54 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=1698</guid>
		<description><![CDATA[Just a quick post to let people know that moving hosts had screwed up all the image paths in my Photography section, a simple MySQL Query fixed the problem. Incase anyone else has this problem I used the following Query:
UPDATE `wp_postmeta` SET  ]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to let people know that moving hosts had screwed up all the image paths in my Photography section, a simple MySQL Query fixed the problem. Incase anyone else has this problem I used the following Query:<span id="more-1698"></span></p>
<p>UPDATE `wp_postmeta` SET meta_value = replace(meta_value,&#8221;/mounted-storage/home58b/sub007/sc37059-NMKM/anthonyshapley.co.uk/&#8221;,&#8221;") WHERE `meta_key` = &#8216;_wp_attached_file&#8217;</p>
<p>It merely finds and replaces text where files have been attached. Run it through phpMyAdmin or whatever you use for a quick fix. Obvisously change the path to reflect your website!</p>
<p>Cheers and special thanks to Alex Morrision for bringing this to my attention.</p>
<p>If your interested in wordpress and SEO check out this <a href="http://www.youtube.com/watch?v=5dkLgaGykVU">UK SEO</a> video.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/fixing-image-paths-in-wordpress-after-moving-hosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First WordPress Plugin: RSS Aggregator</title>
		<link>http://www.anthonyshapley.co.uk/first-wordpress-plugin-rss-aggregator/</link>
		<comments>http://www.anthonyshapley.co.uk/first-wordpress-plugin-rss-aggregator/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 19:35:38 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=1481</guid>
		<description><![CDATA[This last week I&#8217;ve been coding my first WordPress plugin, hence the lack of posts.
I&#8217;ve really enjoyed writing for wordpress so expect to see some more. I&#8217;d highly recommend learning some of it, I would also recommend
You can download the WordPress RSS  ]]></description>
			<content:encoded><![CDATA[<p>This last week I&#8217;ve been coding my first WordPress plugin, hence the lack of posts.</p>
<p>I&#8217;ve really enjoyed writing for wordpress so expect to see some more. I&#8217;d highly recommend learning some of it, I would also recommend</p>
<p>You can download the <a href="http://www.anthonyshapley.co.uk/tools/wordpress-rss-aggregator/">WordPress RSS Aggregator</a> here.</p>
<p>Please feedback if you like/dislike my plugin so I can make further improvements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/first-wordpress-plugin-rss-aggregator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to add Twitter to your Blog</title>
		<link>http://www.anthonyshapley.co.uk/how-to-add-twitter-to-your-blog/</link>
		<comments>http://www.anthonyshapley.co.uk/how-to-add-twitter-to-your-blog/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 22:23:48 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=1452</guid>
		<description><![CDATA[Joost has written an awesome little guide on how to display your last TweetÂ using the Twitter API.
I&#8217;ve added it to my sidebar, check it out. Its ideal for personal blogs since writing a post isn&#8217;t always practical or neccersary.
Incase your wondering what  ]]></description>
			<content:encoded><![CDATA[<p>Joost has written an awesome little guide on <a rel="nofollow" href="http://yoast.com/display-latest-tweet/" target="_blank">how to display your last Tweet</a>Â using the Twitter API.</p>
<p>I&#8217;ve added it to my sidebar, check it out. Its ideal for personal blogs since writing a post isn&#8217;t always practical or neccersary.</p>
<p>Incase your wondering what Twitter is, its a social networking site that allows its users to send updates to followers using no more than 140 characters (much like a text message). You can sign up at <a rel="nofollow" href="http://www.twitter.com" target="_blank">www.twitter.com</a>.</p>
<p>Cheers,</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/how-to-add-twitter-to-your-blog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTTP Referral Spoofing with PHP and cURL</title>
		<link>http://www.anthonyshapley.co.uk/http-referral-spoofing-with-php-and-curl/</link>
		<comments>http://www.anthonyshapley.co.uk/http-referral-spoofing-with-php-and-curl/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 16:41:18 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=545</guid>
		<description><![CDATA[Well I&#8217;m feeling much better, so the other day I was reading a thread on Digital Point, this guy was charging a sh*t load to basically send a shit load of spoofed visitors with a fake Referral header. Therefore I&#8217;ve written a  ]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;m feeling much better, so the other day I was reading a thread on Digital Point, this guy was charging a sh*t load to basically send a shit load of spoofed visitors with a fake Referral header. Therefore I&#8217;ve written a very basic one which you could in theory leave running all night. Unlike this other site I will just release the source code and hopefully cause havok.</p>
<p>All you need is a computer running and a list of proxies in the file &#8220;good-list.txt&#8221;. Put it in a directory (I would keep it private). The source code is as follows:</p>
<p>The code:</p>
<blockquote><p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#8220;&gt;<br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&#8221; lang=&#8221;en&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;HTTP Referrer Spoofing&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;HTTP Referrer Spoofing&lt;/h1&gt;<br />
&lt;p&gt;This will spoof referals in the logs meaning your website will show up as a referrer in the target website statistics.<br />
Â Â  It does by using random proxies from a supplied list, to ensure each request is unique.<br />
&lt;/p&gt;&lt;p&gt;<br />
Â Â  To allow for large requests (in the thousands) I&#8217;ve added the &#8220;Amount before refresh&#8221; option, this will meta refresh the page ensuring<br />
Â Â  the tool does not timeout.&lt;/p&gt;<br />
Â <br />
&lt;/p&gt;<br />
&lt;form method=&#8221;post&#8221; action=&#8221;index.php&#8221;&gt;<br />
Â &lt;fieldset&gt;<br />
Â Â &lt;label&gt;Website to appear as referrer:&lt;/label&gt;<br />
Â Â Â &lt;input type=&#8221;text&#8221; name=&#8221;yoursite&#8221; value=&#8221;&lt;? echo $_REQUEST['yoursite']; ?&gt;&#8221;/&gt;<br />
Â Â &lt;label&gt;Target Website:&lt;/label&gt;<br />
Â Â Â &lt;input type=&#8221;text&#8221; name=&#8221;target&#8221; value=&#8221;&lt;? echo $_REQUEST['target']; ?&gt;&#8221;/&gt;<br />
Â Â &lt;label&gt;Times to Refer&lt;/label&gt;<br />
Â Â Â &lt;input type=&#8221;text&#8221; name=&#8221;amount&#8221; value=&#8221;&lt;? echo $_REQUEST['amount']; ?&gt;&#8221;/&gt;<br />
Â Â &lt;label&gt;Amount before refresh&lt;/label&gt;<br />
Â Â Â &lt;?php<br />
Â Â Â if(empty($_REQUEST['refresh']))<br />
Â Â Â {<br />
Â Â Â Â $refresh = 10;<br />
Â Â Â }<br />
Â Â Â ?&gt;<br />
Â Â Â &lt;input type=&#8221;text&#8221; name=&#8221;refresh&#8221; value=&#8221;&lt;? echo $refresh; ?&gt;&#8221;/&gt;<br />
Â &lt;/fieldset&gt;<br />
Â &lt;input type=&#8221;Submit&#8221; name=&#8221;Submit&#8221; value=&#8221;Submit&#8221;/&gt;<br />
&lt;/form&gt;</p>
<p>Â &lt;?php<br />
Â /*<br />
Â <br />
Â Â Random Proxy Selector<br />
Â <br />
Â */<br />
Â Â function pc_randomint($max = 1)<br />
Â Â {Â <br />
Â Â Â $m = 1000000;<br />
Â Â <br />
Â Â return ((mt_rand(1,$m * $max)-1)/$m);<br />
Â Â }<br />
Â Â function random_proxy()<br />
Â Â {<br />
Â Â Â $line_number = 0;</p>
<p>Â Â Â $fh = fopen(&#8216;good-list.txt&#8217;,'r&#8217;) or die($php_errormsg);<br />
Â Â Â while (! feof($fh))<br />
Â Â Â {<br />
Â Â Â Â if ($s = fgets($fh,1048576))<br />
Â Â Â Â {<br />
Â Â Â Â Â $line_number++;<br />
Â Â Â Â Â if (pc_randomint($line_number) &lt; 1)<br />
Â Â Â Â Â {<br />
Â Â Â Â Â Â Â Â <br />
Â Â Â Â Â Â $line = $s;<br />
Â Â Â Â Â <br />
Â Â Â Â Â }<br />
Â Â Â Â }Â Â <br />
Â Â Â }<br />
Â <br />
Â Â Â fclose($fh) or die($php_errormsg);<br />
Â Â <br />
Â Â Â return $line;<br />
Â Â <br />
Â Â }<br />
Â Â <br />
Â Â /*<br />
Â Â <br />
Â Â Â The fake referral.<br />
Â Â <br />
Â Â */<br />
Â Â function do_fake_referer($yoursite,$target,$amount,$refresh,$done)<br />
Â Â {<br />
Â Â Â // The site to appear in the stats is $yoursite<br />
Â Â Â // The target site is $target<br />
Â Â Â // Amount is the total times the referral should be carried out<br />
Â Â Â // How often to refresh<br />
Â Â Â // How many have been done<br />
Â Â Â echo &#8220;&lt;ol&gt;&#8221;;<br />
Â Â Â $counter_refresh = 0;<br />
Â Â Â while($refresh &gt; $counter_refresh)<br />
Â Â Â {<br />
Â Â Â Â $counter_refresh++;<br />
Â Â Â Â $random_proxy = random_proxy();<br />
Â Â Â Â <br />
Â Â Â Â // create a new cURL resource<br />
Â Â Â Â $ch = curl_init();</p>
<p>Â Â Â Â // set URL and other appropriate options<br />
Â Â Â Â curl_setopt($ch, CURLOPT_URL, $target);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_AUTOREFERER, false);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,7);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_REFERER, $yoursite);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);<br />
Â Â Â Â curl_setopt($ch, CURLOPT_PROXY, $random_proxy);<br />
Â Â Â Â <br />
Â Â Â Â $data = curl_exec($ch);</p>
<p>Â Â Â Â curl_close($ch);<br />
Â Â Â Â <br />
Â Â Â Â if(empty($data))<br />
Â Â Â Â {</p>
<p>Â Â Â Â Â print &#8220;&lt;li&gt;Error, didn&#8217;t work this time. Using proxy &#8220;.$random_proxy.&#8221;.&lt;/li&gt;&#8221;;<br />
Â Â Â Â <br />
Â Â Â Â Â flush();</p></blockquote>
<blockquote><p>Â Â Â Â Â <br />
Â Â Â Â } else {<br />
Â Â Â Â Â $done++;<br />
Â Â Â Â Â print &#8220;&lt;li&gt;Referred &#8220;.$done.&#8221; times. Using &#8220;.$random_proxy.&#8221;.&lt;/li&gt;&#8221;;<br />
Â Â Â Â Â flush();<br />
Â Â Â Â }<br />
Â Â Â }<br />
Â Â Â echo &#8220;&lt;/ol&gt;&#8221;;<br />
Â Â Â if($amount &gt; $done)<br />
Â Â Â {<br />
Â Â Â echo &#8220;&lt;meta http-equiv=\&#8221;refresh\&#8221; content=\&#8221;5;url=index.php?yoursite=&#8221;.$yoursite.&#8221;&amp;target=&#8221;.$target.&#8221;&amp;amount=&#8221;.$amount.&#8221;&amp;refresh=&#8221;.$refresh.&#8221;&amp;done=&#8221;.$done.&#8221;&amp;Submit=Submit\&#8221;/&gt;&#8221;;<br />
Â Â Â echo &#8220;&lt;p&gt;Refreshing in 5 Seconds&lt;/p&gt;&#8221;;Â <br />
Â Â Â }<br />
Â Â Â else<br />
Â Â Â {<br />
Â Â Â echo &#8220;&lt;p&gt;Completed &#8220;.$done.&#8221; spoofs made.&#8221;;<br />
Â Â Â }<br />
Â Â }<br />
Â Â if($_REQUEST['Submit'])<br />
Â Â {<br />
Â Â Â if($amount &gt; $done)<br />
Â Â Â {<br />
Â Â Â Â do_fake_referer($_REQUEST['yoursite'],$_REQUEST['target'],$_REQUEST['amount'],$_REQUEST['refresh'],$_REQUEST['done']);<br />
Â Â Â }<br />
Â Â }<br />
?&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p></blockquote>
<p>Hope this helps, no complaining please.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/http-referral-spoofing-with-php-and-curl/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Reading an XML Sitemap using PHP</title>
		<link>http://www.anthonyshapley.co.uk/reading-an-xml-sitemap-using-php/</link>
		<comments>http://www.anthonyshapley.co.uk/reading-an-xml-sitemap-using-php/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 14:38:18 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=491</guid>
		<description><![CDATA[In this short tutorial I will cover reading a Google/XML Sitemap and grabbing hold of each URL to use as you wish. This is amazingly easy to do:
Firstly we need to pass in the Sitemap URL. In the example we&#8217;re going to  ]]></description>
			<content:encoded><![CDATA[<p>In this short tutorial I will cover reading a Google/XML Sitemap and grabbing hold of each URL to use as you wish. This is amazingly easy to do:</p>
<p>Firstly we need to pass in the Sitemap URL. In the example we&#8217;re going to use GET since this is the most useful in my opinion.</p>
<p>&lt;?php</p>
<p>$sitemap = $_GET['sitemap'];</p>
<p>// Some simple validation<br />
if (!$myxml=simplexml_load_file($sitemap)){<br />
Â Â Â Â echo &#8216;Unable to Access the Sitemap&#8217;;<br />
}<br />
// Loop through XML<br />
foreach($myxml as $url)<br />
{<br />
Â Â Â Â Â Â  $webpage_url = $url-&gt;loc;<br />
Â Â Â Â Â Â Â // <strong>Do your thing here, store it in a database, run it against a function etc.<br />
</strong>}<br />
?&gt;</p>
<p>This is ideal for reading a sitemap or RSS feed. Give it a try <img src='http://www.anthonyshapley.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/reading-an-xml-sitemap-using-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Validating a website in PHP</title>
		<link>http://www.anthonyshapley.co.uk/validating-a-website-in-php/</link>
		<comments>http://www.anthonyshapley.co.uk/validating-a-website-in-php/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 08:09:02 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthonyshapley.co.uk/?p=485</guid>
		<description><![CDATA[I found this pretty hard to begin with I was uncertain of how to check whether a website was online without writing a complicated string of Regular Express and even then this didn&#8217;t check if the site was active at that point  ]]></description>
			<content:encoded><![CDATA[<p>I found this pretty hard to begin with I was uncertain of how to check whether a website was online without writing a complicated string of Regular Express and even then this didn&#8217;t check if the site was active at that point in time. The solution was supprisingly simple:</p>
<p>We can use the PHP Function &#8220;fsockopen&#8221; to check that a the port is open on the appropriate hostname (website address).</p>
<p>$urlExists = @fsockopen($siteurl,80);</p>
<p>if($urlExists) {</p>
<p>// do something</p>
<p>} else {</p>
<p>// show an error</p>
<p>}</p>
<p>Simply pass in the Site URL Variable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/validating-a-website-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>9 Programming Rules</title>
		<link>http://www.anthonyshapley.co.uk/9-programming-rules/</link>
		<comments>http://www.anthonyshapley.co.uk/9-programming-rules/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 12:53:35 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anthonyshapley.co.uk/blog/?p=18</guid>
		<description><![CDATA[1. KISS &#8211; Keep it Simple Stupid, this also applies to designing programs, why do these things need to be so complicated?
2. ID Division, at the top of every page/program put an ID Division so we know what this section does and  ]]></description>
			<content:encoded><![CDATA[<p>1. KISS &#8211; Keep it Simple Stupid, this also applies to designing programs, why do these things need to be so complicated?</p>
<p>2. ID Division, at the top of every page/program put an ID Division so we know what this section does and who the author is.</p>
<p>3. Comment on each section of code so we understand its objective.</p>
<p>4. Declare your variables.</p>
<p>5. Use meaningful variable names.</p>
<p>6. Use an appropriate prefix for each objects name.</p>
<p>7. Progressively indent your code so its easier to read.</p>
<p>8. Back up!</p>
<p>9. Meet your end objectives.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonyshapley.co.uk/9-programming-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

