<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Absolutize Relative Links Using PHP and Preg_Replace_Callback</title>
	<atom:link href="http://seanbehan.com/php/absolutize-relative-links-using-php-and-preg_replace_callback/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com/php/absolutize-relative-links-using-php-and-preg_replace_callback/</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Mon, 30 Jan 2012 12:48:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Sean Behan</title>
		<link>http://seanbehan.com/php/absolutize-relative-links-using-php-and-preg_replace_callback/#comment-73</link>
		<dc:creator>Sean Behan</dc:creator>
		<pubDate>Thu, 14 Jan 2010 20:22:24 +0000</pubDate>
		<guid isPermaLink="false">http://seanbehan.com/?p=727#comment-73</guid>
		<description>a little shorter still...
&lt;?php
$url = parse_url($_GET[&#039;url&#039;]);
function absolutize($string){
  global $url;
  $absolute = substr($string[1],0,7) == &quot;http://&quot; ? true : false;
  if($absolute){ return $string[0]; }
  return &quot;href=&#039;&quot;.$url[&#039;scheme&#039;].&quot;://&quot;.$url[&#039;host&#039;].&quot;&quot;.$string[1].&quot;&#039;&quot;;
}
$contents = file_get_contents($_GET[&#039;url&#039;]);
$contents = preg_replace_callback(&quot;/\bhref=[\&quot;&#124;&#039;](.*?)[\&quot;&#124;&#039;]/&quot;, &quot;absolutize&quot;, $contents);
print $contents;</description>
		<content:encoded><![CDATA[<p>a little shorter still&#8230;<br />
&lt;?php<br />
$url = parse_url($_GET['url']);<br />
function absolutize($string){<br />
  global $url;<br />
  $absolute = substr($string[1],0,7) == &#8220;http://&#8221; ? true : false;<br />
  if($absolute){ return $string[0]; }<br />
  return &#8220;href=&#8217;&#8221;.$url['scheme'].&#8221;://&#8221;.$url['host'].&#8221;".$string[1].&#8221;&#8216;&#8221;;<br />
}<br />
$contents = file_get_contents($_GET['url']);<br />
$contents = preg_replace_callback(&#8220;/\bhref=[\"|'](.*?)[\"|']/&#8221;, &#8220;absolutize&#8221;, $contents);<br />
print $contents;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

