<?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>Sentido Web &#187; url</title>
	<atom:link href="http://sentidoweb.com/tag/url/feed" rel="self" type="application/rss+xml" />
	<link>http://sentidoweb.com</link>
	<description>Desarrollo web, HTML, CSS, Javascript, PHP, MySQL</description>
	<lastBuildDate>Tue, 10 Apr 2012 01:02:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Acortar URLs mediante goo.gl y PHP</title>
		<link>http://sentidoweb.com/2011/01/18/acortar-urls-mediante-goo-gl-y-php.php</link>
		<comments>http://sentidoweb.com/2011/01/18/acortar-urls-mediante-goo-gl-y-php.php#comments</comments>
		<pubDate>Tue, 18 Jan 2011 10:02:14 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[acortador]]></category>
		<category><![CDATA[goo.gl]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/?p=2670</guid>
		<description><![CDATA[La API de Google para acortar URLs permite acortar URLs, recuperar info del link original y las URLs acortadas de un usuario, aunque para usarlo se necesita crear una clave y dar de alta proyecto. El resto es fácil, acceso mediante CURL y listo: define&#40;'GOOGLE_API_KEY', '[insert your key here]'&#41;; define&#40;'GOOGLE_ENDPOINT', 'https://www.googleapis.com/urlshortener/v1'&#41;; function shortenUrl&#40;$longUrl&#41; &#123; // [...]]]></description>
			<content:encoded><![CDATA[<p>La <a href="http://code.google.com/apis/urlshortener/index.html">API de Google para acortar URLs</a> permite acortar URLs, recuperar info del link original y las URLs acortadas de un usuario, aunque para usarlo se necesita crear una clave y dar de alta proyecto.</p>
<p>El resto es fácil, acceso mediante CURL y listo:</p>
<pre><code><pre class="php">    <a href="http://www.php.net/define"><span style="color: #000066;">define</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'GOOGLE_API_KEY'</span>, <span style="color: #ff0000;">'[insert your key here]'</span><span style="color: #66cc66;">&#41;</span>;
    <a href="http://www.php.net/define"><span style="color: #000066;">define</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'GOOGLE_ENDPOINT'</span>, <span style="color: #ff0000;">'https://www.googleapis.com/urlshortener/v1'</span><span style="color: #66cc66;">&#41;</span>;
 
    <span style="color: #000000; font-weight: bold;">function</span> shortenUrl<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$longUrl</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// initialize the cURL connection</span>
        <span style="color: #3E6D8F;">$ch</span> = curl_init<span style="color: #66cc66;">&#40;</span>
            <a href="http://www.php.net/sprintf"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%s/url?key=%s'</span>, GOOGLE_ENDPOINT, GOOGLE_API_KEY<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// tell cURL to return the data rather than outputting it</span>
        curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span>, CURLOPT_RETURNTRANSFER, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// create the data to be encoded into JSON</span>
        <span style="color: #3E6D8F;">$requestData</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
            <span style="color: #ff0000;">'longUrl'</span> =&gt; <span style="color: #3E6D8F;">$longUrl</span>
        <span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// change the request type to POST</span>
        curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span>, CURLOPT_POST, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// set the form content type for JSON data</span>
        curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span>, CURLOPT_HTTPHEADER, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Content-type: application/json'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// set the post body to encoded JSON data</span>
        curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span>, CURLOPT_POSTFIELDS, json_encode<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$requestData</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// perform the request</span>
        <span style="color: #3E6D8F;">$result</span> = curl_exec<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span><span style="color: #66cc66;">&#41;</span>;
        curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$ch</span><span style="color: #66cc66;">&#41;</span>;
 
        <span style="color: #808080; font-style: italic;">// decode and return the JSON response</span>
        <span style="color: #723b00;">return</span> json_decode<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$result</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
 
    <span style="color: #3E6D8F;">$response</span> = shortenUrl<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://phpriot.com'</span><span style="color: #66cc66;">&#41;</span>;
 
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/sprintf"><span style="color: #000066;">sprintf</span></a><span style="color: #66cc66;">&#40;</span>
        <span style="color: #ff0000;">'%s was shortened to %s'</span>,
        <span style="color: #3E6D8F;">$response</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'longUrl'</span><span style="color: #66cc66;">&#93;</span>,
        <span style="color: #3E6D8F;">$response</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'id'</span><span style="color: #66cc66;">&#93;</span>
    <span style="color: #66cc66;">&#41;</span>;</pre></code></pre>
<p><a href="http://www.phpriot.com/articles/google-url-shorening-api">Shortening URLs for goo.gl with Google&#8217;s URL Shortener API</a></p>
<p>Vía / <a href="http://www.phpdeveloper.org/news/15726">PHPDeveloper.org</a></p>]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2011/01/18/acortar-urls-mediante-goo-gl-y-php.php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Obtener URLs para usuarios en Codeigniter</title>
		<link>http://sentidoweb.com/2010/09/22/obtener-urls-para-usuarios-en-codeigniter.php</link>
		<comments>http://sentidoweb.com/2010/09/22/obtener-urls-para-usuarios-en-codeigniter.php#comments</comments>
		<pubDate>Wed, 22 Sep 2010 07:37:55 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeginiter]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/?p=2597</guid>
		<description><![CDATA[
Codeigniter tiene una método para tratar con las URLs: http://dominio/controlador/metodo/param1/param2/&#8230; El problema viene cuando nuestra aplicación necesita URLs diferentes, como las de Twitter u otra red social, que son del tipo http://dominio/username. Para ello primero se debe cambiar el archivo routes.php de la configuración: //Excluir estos controladores cuando se generan las URLs $route&#91;'(login&#124;oauth&#124;site&#124;search)(.*)'&#93; = '1'; [...]]]></description>
			<content:encoded><![CDATA[
<p>Codeigniter tiene una método para tratar con las URLs: http://dominio/controlador/metodo/param1/param2/&#8230; El problema viene cuando nuestra aplicación necesita URLs diferentes, como las de Twitter u otra red social, que son del tipo http://dominio/username.</p>
<p>Para ello primero se debe cambiar el archivo routes.php de la configuración:</p>
<pre><code><pre class="php"><span style="color: #808080; font-style: italic;">//Excluir estos controladores cuando se generan las URLs</span>
<span style="color: #3E6D8F;">$route</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'(login|oauth|site|search)(.*)'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'1'</span>;  
 
<span style="color: #808080; font-style: italic;">//Las URLs de los usuarios</span>
<span style="color: #3E6D8F;">$route</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'[a-zA-Z0-9]+/(add|edit)'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'users/1'</span>;
<span style="color: #3E6D8F;">$route</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'[a-zA-Z0-9]+'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'users/profile'</span>;</pre></code></pre>
<p>Después habrá que modificar el .htaccess para usar APP_PATH:</p>
<pre><code><pre class="apache"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
 
<span style="color: #00007f;">RewriteBase</span> /
 
<span style="color: #00007f;">RewriteCond</span> %<span style="color: #66cc66;">&#123;</span>ENV:REDIRECT_APP_PATH<span style="color: #66cc66;">&#125;</span> !^$
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>$ - <span style="color: #66cc66;">&#91;</span>E=APP_PATH:%<span style="color: #66cc66;">&#123;</span>ENV:REDIRECT_APP_PATH<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span>
 
<span style="color: #00007f;">RewriteCond</span> %<span style="color: #66cc66;">&#123;</span>ENV:APP_PATH<span style="color: #66cc66;">&#125;</span> ^$
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>$ - <span style="color: #66cc66;">&#91;</span>E=APP_PATH:/$<span style="color: #ff0000;">1</span><span style="color: #66cc66;">&#93;</span>
 
<span style="color: #00007f;">RewriteCond</span> $<span style="color: #ff0000;">1</span> !^<span style="color: #66cc66;">&#40;</span>index\.php|img|css|js|robots\.txt|favicon\.ico<span style="color: #66cc66;">&#41;</span>
<span style="color: #00007f;">RewriteCond</span> %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-f
<span style="color: #00007f;">RewriteCond</span> %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-d
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>$ index.php <span style="color: #66cc66;">&#91;</span>L<span style="color: #66cc66;">&#93;</span></pre></code></pre>
<p>Y por último modificar el config.php para indicar que debe usar el APP_PATH:</p>
<pre><code><pre class="php"><span style="color: #3E6D8F;">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'uri_protocol'</span><span style="color: #66cc66;">&#93;</span>    = <span style="color: #ff0000;">"APP_PATH"</span>;
 
<span style="color: #3E6D8F;">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'enable_query_strings'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">TRUE</span>;</pre></code></pre>
<p><a href="http://brandonbeasley.com/blog/codeigniter-vanity-urls/">Codeigniter Vanity URLs</a></p>
<p>Vía / <a href="http://www.phpdeveloper.org/news/15143">PHPDeveloper.org</a></p>]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2010/09/22/obtener-urls-para-usuarios-en-codeigniter.php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HTML5′s “email” and “url” Input Types</title>
		<link>http://sentidoweb.com/2010/09/17/html5%e2%80%b2s-%e2%80%9cemail%e2%80%9d-and-%e2%80%9curl%e2%80%9d-input%c2%a0types.php</link>
		<comments>http://sentidoweb.com/2010/09/17/html5%e2%80%b2s-%e2%80%9cemail%e2%80%9d-and-%e2%80%9curl%e2%80%9d-input%c2%a0types.php#comments</comments>
		<pubDate>Fri, 17 Sep 2010 21:06:46 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Quicklinks]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://davidwalsh.name/html5-email</guid>
		<description><![CDATA[I’ve already covered some subtle HTML5 improvements like placeholder, prefetching, and web storage.  Today I want to introduce a few new INPUT element types:  email and url.  Let’s take a very basic look at these new INPUT types and discuss their advantages.The SyntaxThe syntax is as basic as a text input;  instead, you set the type [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve already covered some subtle HTML5 improvements like placeholder, prefetching, and web storage.  Today I want to introduce a few new INPUT element types:  email and url.  Let’s take a very basic look at these new INPUT types and discuss their advantages.The SyntaxThe syntax is as basic as a text input;  instead, you set the type to “email” or “ &#8230;</p>
<p><a href="http://davidwalsh.name/html5-email" title="HTML5′s “email” and “url” Input Types">Post original</a></p>]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2010/09/17/html5%e2%80%b2s-%e2%80%9cemail%e2%80%9d-and-%e2%80%9curl%e2%80%9d-input%c2%a0types.php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Definitive URL Sanitizer: plugin para WP que sanea las URLs</title>
		<link>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php</link>
		<comments>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php#comments</comments>
		<pubDate>Fri, 27 Feb 2009 16:20:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sanitizer]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php</guid>
		<description><![CDATA[Mi compañero David cansado de las URLs que genera WordPress (y quién no) ha creado un plugin que limpia las URLs de los posts de WP quitándole los caracteres &#8220;extraños&#8221;. WP deja las interrogaciones (¿), comillas (“ ”) y otros caracteres más que se sustituyen por su correspondiente código (%nn). Probado para UTF-8 y compatible [...]]]></description>
			<content:encoded><![CDATA[Mi compañero <a href="http://dmnet.bitacoras.com">David</a> cansado de las URLs que genera WordPress (y quién no) ha creado un plugin que limpia las URLs de los posts de WP quitándole los caracteres &#8220;extraños&#8221;.
WP deja las interrogaciones (¿), comillas (“ ”) y otros caracteres más que se sustituyen por su correspondiente código (%nn).
Probado para UTF-8 y compatible con WP2.7+
<a href="http://dmnet.bitacoras.com/archivos/wordpress/the-definitive-url-sanitizer.php">The Definitive URL Sanitizer </a>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

