<?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>tinyurl | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/tinyurl/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Thu, 15 Oct 2009 11:38:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Tiny URLs mit PHP und der tinyurl API</title>
		<link>https://nerdpress.org/2009/10/15/tiny-urls-mit-php-und-de-tinyurl-api/</link>
					<comments>https://nerdpress.org/2009/10/15/tiny-urls-mit-php-und-de-tinyurl-api/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Thu, 15 Oct 2009 11:38:59 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[tinyurl]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=409</guid>

					<description><![CDATA[<p>für den Fall dass ich nicht der einzige bin, der das bis vorhin nicht wusste: tinyurl.com hat auch eine API. Die ist zwar unglaublich simpel, aber das ist doch auch mal schön. und vice versa (hackish): und noch die CURL variante von ersterem (via davidwalsh)</p>
The post <a href="https://nerdpress.org/2009/10/15/tiny-urls-mit-php-und-de-tinyurl-api/">Tiny URLs mit PHP und der tinyurl API</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>für den Fall dass ich nicht der einzige bin, der das bis vorhin nicht wusste:</p>
<p><a href="http://tinyurl.com/">tinyurl.com</a> hat auch eine API.<br />
Die ist zwar unglaublich simpel, aber das ist doch auch mal schön.</p>
<pre class="brush: php; title: ; notranslate">
$tinyURL =  file_get_contents( &#039;http://tinyurl.com/api-create.php?url=&#039;.$tooLongURL );
</pre>
<p>und vice versa (hackish):</p>
<pre class="brush: php; title: ; notranslate">
function reverse_tinyurl($url){
            // Resolves a TinyURL.com encoded url to it&#039;s source.
            $url = explode(&#039;.com/&#039;, $url);
            $url = &#039;http://preview.tinyurl.com/&#039;.$url&#x5B;1];
            $preview = file_get_contents($url);
            preg_match(&#039;/redirecturl&quot; href=&quot;(.*)&quot;&gt;/&#039;, $preview, $matches);
            return $matches&#x5B;1];
        }
</pre>
<p><span id="more-409"></span></p>
<p>und noch die CURL variante von ersterem (via <a href="http://davidwalsh.name">davidwalsh</a>)</p>
<pre class="brush: php; title: ; notranslate">

//gets the data from a URL  
function get_tiny_url($url)  
{  
	$ch = curl_init();  
	$timeout = 5;  
	curl_setopt($ch,CURLOPT_URL,&#039;http://tinyurl.com/api-create.php?url=&#039;.$url);  
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);  
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);  
	$data = curl_exec($ch);  
	curl_close($ch);  
	return $data;  
}
</pre>The post <a href="https://nerdpress.org/2009/10/15/tiny-urls-mit-php-und-de-tinyurl-api/">Tiny URLs mit PHP und der tinyurl API</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2009/10/15/tiny-urls-mit-php-und-de-tinyurl-api/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
