<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: php code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 06 Oct 2008 12:36:15 GMT</pubDate>
    <description>DZone Snippets: php code</description>
    <item>
      <title>Create and lookup tinyurls with PHP</title>
      <link>http://snippets.dzone.com/posts/show/4720</link>
      <description>&lt;code&gt;&lt;br /&gt;        function reverse_tinyurl($url){&lt;br /&gt;            // Resolves a TinyURL.com encoded url to it's source.&lt;br /&gt;            $url = explode('.com/', $url);&lt;br /&gt;            $url = 'http://preview.tinyurl.com/'.$url[1];&lt;br /&gt;            $preview = file_get_contents($url);&lt;br /&gt;            preg_match('/redirecturl" href="(.*)"&gt;/', $preview, $matches);&lt;br /&gt;            return $matches[1];&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        function tinyurl($url){&lt;br /&gt;        // Shortens a url&lt;br /&gt;            $html = file_get_contents("http://tinyurl.com/create.php?url=".$url);&lt;br /&gt;            preg_match('/http:\/\/preview\.tinyurl\.com\/(.*)&lt;\/b&gt;/', $html, $matches);&lt;br /&gt;            return "http://tinyurl.com/".$matches[1];&lt;br /&gt;        } &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 31 Oct 2007 05:42:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4720</guid>
      <author>logankoester (Logan Koester)</author>
    </item>
    <item>
      <title>Reverse TinyURL</title>
      <link>http://snippets.dzone.com/posts/show/4237</link>
      <description>// Resolves a TinyURL.com encoded url to it's source.&lt;br /&gt;// Example: reverse_tinyurl('http://tinyurl.com/2ocfun') =&gt; "http://logankoester.com"&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function reverse_tinyurl($url){&lt;br /&gt;	$url = explode('.com/', $url);&lt;br /&gt;	$url = 'http://preview.tinyurl.com/'.$url[1];&lt;br /&gt;	$preview = file_get_contents($url);&lt;br /&gt;	preg_match('/redirecturl" href="(.*)"&gt;/', $preview, $matches);&lt;br /&gt;	return $matches[1];&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 02 Jul 2007 07:04:25 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4237</guid>
      <author>logankoester (Logan Koester)</author>
    </item>
    <item>
      <title>Tidy Remote HTML (using a web service)</title>
      <link>http://snippets.dzone.com/posts/show/4218</link>
      <description>// Clean up some code using a web service. If you need to do this more quickly I suggest using a local tidy installation&lt;br /&gt;// rather than my web service, but this is nice and easy. :)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function tidied($url) {&lt;br /&gt;  /* Cleans up a page via Tidy, returning the cleaned up html as a string&lt;br /&gt;   * By Logan Koester &lt;logan@logankoester.com&gt; 2007-06-28&lt;br /&gt;   * Props to http://infohound.net/tidy */&lt;br /&gt;  return file_get_contents("http://logankoester.com/tools/tidy.php?q=$url");&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 28 Jun 2007 10:16:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4218</guid>
      <author>logankoester (Logan Koester)</author>
    </item>
    <item>
      <title>Regex: "Link to Ebay item"</title>
      <link>http://snippets.dzone.com/posts/show/2627</link>
      <description>// Perl-compatible regex to parse hyperlinks to auctions on ebay&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/&lt;a href="(http:\/\/cgi.ebay.com\/.*?ViewItem)"&gt;/&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 20 Sep 2006 09:20:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2627</guid>
      <author>logankoester (Logan Koester)</author>
    </item>
  </channel>
</rss>
