<?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>LuAuF &#187; PHP</title>
	<atom:link href="http://luauf.com/category/programacion/php-programacion/feed/" rel="self" type="application/rss+xml" />
	<link>http://luauf.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 01:44:47 +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>Clase de Logs para PHP</title>
		<link>http://luauf.com/2009/06/16/clase-de-logs-para-php/</link>
		<comments>http://luauf.com/2009/06/16/clase-de-logs-para-php/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 09:30:38 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Archivos]]></category>
		<category><![CDATA[Código]]></category>
		<category><![CDATA[Clases]]></category>
		<category><![CDATA[Logs]]></category>
		<category><![CDATA[trazas]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=1048</guid>
		<description><![CDATA[Por más entorno de debug que exista, los archivos de log son fundamentales para tracear el comportamiento de cualquier aplicación. Una aplicación web escrita en PHP no se escapa de este requerimiento tampoco. Por tal motivo, navegando, encontré una sencilla clase para generar archivos de log. Y como siempre se necesita tener a mano código [...]]]></description>
			<content:encoded><![CDATA[<p>Por más entorno de debug que exista, los archivos de log son fundamentales para tracear el comportamiento de cualquier aplicación. Una aplicación web escrita en PHP no se escapa de este requerimiento tampoco.</p>
<p>Por tal motivo, navegando, encontré una sencilla clase para generar archivos de log. Y como siempre se necesita tener a mano código como tal, no viene mal su publicación.</p>
<p><span id="more-1048"></span>El código de la clase es pequeño y sencillo, muestra por cada línea la hora y fecha en la que se escribió, así como arrays formateados. Algunas mejoras que se le pueden realizar, pero que no se escriben para no manchar el código original del autor son:</p>
<ul>
<li>Especificar el nombre del archivo de log en el constructor o bien formarlo con el nombre del archivo o según el gusto de cada uno. Simplemente, es evitar el cableado del mismo (hoy en día, protected $_fileName = 'myLogger.log';)</li>
<li>Crear archivos de logs por año y mes, o por año mes y día, esto con el único objetivo de no disponer de un único archivo enorme que con el paso del tiempo no pare de crecer y crecer.</li>
</ul>
<p>Ahora si, el código y luego un pequeño ejemplo de su utilización:</p>
<div class="syntax_hilite">
<div id="php-3">
<div class="php"><span style="color:#008000;">/**<br />
&nbsp; &nbsp;&nbsp; * myLogger<br />
&nbsp; &nbsp;&nbsp; * @author Edder Rojas Douglas<br />
&nbsp; &nbsp;&nbsp; * @version 0.2<br />
&nbsp; &nbsp;&nbsp; */</span></p>
<p>&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">class</span> myLogger&nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color:#0000FF;">$_fileName</span> = <span style="color:#FF0000;">'myLogger.log'</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * @param string $path can be a directory o a file path<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> __construct<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Throw <span style="color:#000000; font-weight:bold;">new</span> Exception<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Path must be filled"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/file_exists"><span style="color:#000066;">file_exists</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Throw <span style="color:#000000; font-weight:bold;">new</span> Exception<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"The Path doesn't exists."</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/is_writeable"><span style="color:#000066;">is_writeable</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Throw <span style="color:#000000; font-weight:bold;">new</span> Exception<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"You can write on the give path"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_path = <span style="color:#0000FF;">$this</span>-&gt;_parsePath<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * Validate the path the add the filename to the path<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * @param String $path<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * @return String<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color:#000000; font-weight:bold;">function</span> _parsePath<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$strLenght</span> = <a href="http://www.php.net/strlen"><span style="color:#000066;">strlen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$lastChar</span> = <a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span>, <span style="color:#0000FF;">$strLenght</span> - <span style="color:#CC66CC;">1</span>, <span style="color:#0000FF;">$strLenght</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$path</span> = <span style="color:#0000FF;">$lastChar</span> != <span style="color:#FF0000;">"/"</span> ? <span style="color:#0000FF;">$path</span> . <span style="color:#FF0000;">"/"</span> : <span style="color:#0000FF;">$path</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/is_dir"><span style="color:#000066;">is_dir</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#616100;">return</span> <span style="color:#0000FF;">$path</span> . <span style="color:#0000FF;">$this</span>-&gt;_fileName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#616100;">return</span> <span style="color:#0000FF;">$path</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * Will save the path on the give path<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * @param String $line<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color:#000000; font-weight:bold;">function</span> _save<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$fhandle</span> = <a href="http://www.php.net/fopen"><span style="color:#000066;">fopen</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_path, <span style="color:#FF0000;">"a+"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f write<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fhandle</span>, <span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fhandle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * main function to add lines to the logging file<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * @param String $line<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> addLine<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$line</span> = <a href="http://www.php.net/is_array"><span style="color:#000066;">is_array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <a href="http://www.php.net/print_r"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span>, <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#0000FF;">$line</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$line</span> = <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"d-m-Y h:i:s"</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">": $line<span style="color:#000099; font-weight:bold;">\n</span>"</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_save<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="php-4">
<div class="php"><span style="color:#616100;">require_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'myLogger.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$log</span> = <span style="color:#000000; font-weight:bold;">new</span> myLogger<span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/dirname"><span style="color:#000066;">dirname</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">"/log"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$log</span>-&gt;<span style="color:#006600;">addLine</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"testing"</span>, <span style="color:#FF0000;">"my"</span>, <span style="color:#FF0000;">'data'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Vía: <a href="http://paindev.wordpress.com/2009/05/04/una-clase-php-para-hacer-archivos-log/">Pain Dev</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2009/06/16/clase-de-logs-para-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>¿Qué es y cómo se utiliza memcached?</title>
		<link>http://luauf.com/2009/06/08/%c2%bfque-es-memcached/</link>
		<comments>http://luauf.com/2009/06/08/%c2%bfque-es-memcached/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 08:00:33 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[memoria]]></category>
		<category><![CDATA[programacion web]]></category>
		<category><![CDATA[servidor]]></category>
		<category><![CDATA[servidor web]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[webmaster]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=1035</guid>
		<description><![CDATA[Hace unos días, leyendo acerca de la arquitectura de Facebook leí acerca de servidores Web y de servidores de Memcache. Alejado hace algunos años del desarrollo web no tenía ni idea de que se trataba esto. Leyendo mis feeds encuentro una publicación acerca de Memcached, que me sirvió para entender un poco más de que [...]]]></description>
			<content:encoded><![CDATA[<p>Hace unos días, leyendo acerca de la arquitectura de <strong>Facebook</strong> leí acerca de servidores <strong>Web</strong> y de servidores de <strong>Memcache</strong>. Alejado hace algunos años del desarrollo web no tenía ni idea de que se trataba esto.</p>
<p>Leyendo mis feeds encuentro una publicación acerca de Memcached, que me sirvió para entender un poco más de que se trata y como se utiliza de una forma por demás de clara.</p>
<p><strong>Memcached</strong> es un sistema de caché distribuido que se utiliza para guardar los datos de las aplicaciones en un (conjunto de) servidor(es) (servidores de caché), todo esto de una forma sencilla y transparente. Estas caracaterísticas lo han convertido en un sistema muy utilizado en varios proyectos.</p>
<p><strong>Memcached</strong> permite guardar lo que se nos ocurra y que a nuestro criterio sea digno de ser "<strong>cacheado</strong>", ejemplo: resultados de cálculos o consultas a base de datos complejas, información de sesiones de los usuarios, etc.</p>
<p><strong>Memcached</strong> se ejecuta en uno o varios equipos que actuará(n) como servidores y de los cuales, entre otros parámetros, se puede ajustar el tamaño de la memoria que queremos que utilice para ello.</p>
<p>Una vez instalados los servidores, las aplicaciones a través de una API podrán guardar elementos en la caché, recuperarlos o borrarlos, todo esto de una forma muy sencilla.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2009/06/memcachedarchitecture.gif"><img class="alignnone size-medium wp-image-1036" title="memcachedarchitecture" src="http://luauf.com/wp-content/uploads/2009/06/memcachedarchitecture-300x252.gif" alt="memcachedarchitecture" width="300" height="252" /></a></p>
<p><span id="more-1035"></span>Para aquellos lectores más técnicos que no se quieren quedar solamente con definiciones, veamos un poco como sería poner en marcha un servidor memcached y como hacer uso del mismo desde PHP.</p>
<p>Si eres usuario de Debian o Debian/Ubuntu, simplemente con tener configurados los repositorios adecuados puedes descargar memcached a través de <a href="http://luauf.com/2009/03/18/tips-para-el-uso-de-apt/">Aptitude</a>: <strong>aptitude install memcached</strong> o <strong>sudo aptitude install memcached</strong>.</p>
<p>La configuración del servicio se realiza por medio del arhchivo <strong>/etc/memcached.conf</strong> y en el mismo se pueden modificar parámetros como IP y puerto al que escucha, tamaño de la memoria que le dedicaremos, etc.</p>
<p>Debido a que se instala como cualquier otro servicio, lo controlaremos como cualquier otro servicio, por ejemplo: <strong>/etc/inid.d/memcached restart</strong> o sudo <strong>/etc/inid.d/memcached restart</strong>.</p>
<p>Como se mencionó antes, las aplicaciones deben hacer uso de una API para utilizar memcached, por ejemplo, para el caso de PHP existen dos versiones, la primera memcache y la segunda memcached. También podemos instalarlas por medio de  <a href="http://luauf.com/2009/03/18/tips-para-el-uso-de-apt/">Aptitude</a>: <strong>aptitude install php5-memcache</strong> o <strong>sudo  aptitude install php5-memcache</strong>. Para que esté disponible restaría descomentar la línea de la extensión en el archivo <strong>/etc/php5/conf.d/memcache.ini</strong>. Para comprobar que todo esté como corresponde podemos ejecutar la función <strong>phpinfo()</strong> de php.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2009/06/php-memcache.png"><img class="alignnone size-medium wp-image-1037" title="php-memcache" src="http://luauf.com/wp-content/uploads/2009/06/php-memcache-300x143.png" alt="php-memcache" width="300" height="143" /></a></p>
<p>Finalmente, para los entendidos, un pequeño script php que hace uso del servicio:</p>
<div class="syntax_hilite">
<div id="php-6">
<div class="php"><span style="color:#000000; font-weight:bold;">&lt;?php</span><br />
<span style="color:#0000FF;">$memcache</span> = <span style="color:#000000; font-weight:bold;">new</span> Memcache;<br />
<span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">connect</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'localhost'</span>, <span style="color:#CC66CC;">11211</span><span style="color:#006600; font-weight:bold;">&#41;</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Could not connect"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp;<br />
<span style="color:#0000FF;">$version</span> = <span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">getVersion</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Server's version: "</span>.<span style="color:#0000FF;">$version</span>.<span style="color:#FF0000;">"n"</span>;<br />
&nbsp; &nbsp;<br />
<span style="color:#0000FF;">$tmp_object</span> = <span style="color:#000000; font-weight:bold;">new</span> stdClass;<br />
<span style="color:#0000FF;">$tmp_object</span>-&gt;<span style="color:#006600;">str_attr</span> = <span style="color:#FF0000;">'test'</span>;<br />
<span style="color:#0000FF;">$tmp_object</span>-&gt;<span style="color:#006600;">int_attr</span> = <span style="color:#CC66CC;">123</span>;<br />
&nbsp; &nbsp;<br />
<span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'key'</span>, <span style="color:#0000FF;">$tmp_object</span>, <span style="color:#000000; font-weight:bold;">false</span>, <span style="color:#CC66CC;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Failed to save data at the server"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Store data in the cache (data will expire in 10 seconds)"</span>;<br />
&nbsp; &nbsp;<br />
<span style="color:#0000FF;">$get_result</span> = <span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'key'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Data from the cache:"</span>;<br />
&nbsp; &nbsp;<br />
<a href="http://www.php.net/var_dump"><span style="color:#000066;">var_dump</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$get_result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</div>
</div>
<p></p>
<p>Vía: <a href="http://www.eslomas.com/index.php/archives/2009/05/15/instalacion-y-uso-de-memcache-con-php/">EsLoMas.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2009/06/08/%c2%bfque-es-memcached/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Hojas de referencia de PHP, MySQL, Javascript y CSS</title>
		<link>http://luauf.com/2008/06/09/hojas-de-referencia-de-php-mysql-javascript-y-css/</link>
		<comments>http://luauf.com/2008/06/09/hojas-de-referencia-de-php-mysql-javascript-y-css/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 02:48:30 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[Bases de Datos]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=396</guid>
		<description><![CDATA[Las hojas de referencia ILoveJackDaniels ya son conocidas por la web, pero no está de más recordar algunas: PHP: funciones, variables superglobales, formato de fechas, expresiones regulares y apertura de archivos. MySQL: funciones de MySQL, tipos de datos, funciones en PHP y consultas de ejemplo. Javascript: funciones y métodos, XMLHttpRequest, Javascript en HTML, expresiones regulares [...]]]></description>
			<content:encoded><![CDATA[<p>Las hojas de referencia <a href="http://www.ilovejackdaniels.com/" target="_blank">ILoveJackDaniels </a>ya son conocidas por la web, pero no está de más recordar algunas:</p>
<ul>
<li><strong>PHP</strong>: funciones, variables superglobales, formato de fechas, expresiones regulares y apertura de archivos.</li>
<li><strong>MySQL</strong>: funciones de MySQL, tipos de datos, funciones en PHP y consultas de ejemplo.</li>
<li><strong>Javascript</strong>: funciones y métodos, XMLHttpRequest, Javascript en HTML, expresiones regulares y manejadores de eventos.</li>
<li><strong>CSS</strong>: lista de propiedades, selectores, pseudo-selectores, unidades y propiedades.</li>
</ul>
<p>A continuación, y para su descarga, las hojas de referencia en PNG y PDF:</p>
<p><span id="more-396"></span></p>
<ul>
<li><a href="http://luauf.com/wp-content/uploads/2008/06/php_cheat_sheet.pdf">PHP</a></li>
</ul>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/06/php_cheat_sheet.png"><img class="aligncenter size-medium wp-image-404" title="php_cheat_sheet" src="http://luauf.com/wp-content/uploads/2008/06/php_cheat_sheet-220x300.png" alt="" width="220" height="300" /></a></p>
<ul>
<li><a href="http://luauf.com/wp-content/uploads/2008/06/mysql_cheat_sheet.pdf">MySQL</a></li>
</ul>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/06/mysql_cheat_sheet.png"><img class="aligncenter size-medium wp-image-403" title="mysql_cheat_sheet" src="http://luauf.com/wp-content/uploads/2008/06/mysql_cheat_sheet-230x300.png" alt="" width="230" height="300" /></a></p>
<ul>
<li><a href="http://luauf.com/wp-content/uploads/2008/06/javascript_cheat_sheet.pdf">Javascript</a></li>
</ul>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/06/javascript_cheat_sheet.png"><img class="aligncenter size-medium wp-image-402" title="javascript_cheat_sheet" src="http://luauf.com/wp-content/uploads/2008/06/javascript_cheat_sheet-220x300.png" alt="" width="220" height="300" /></a></p>
<ul>
<li><a href="http://luauf.com/wp-content/uploads/2008/06/css_cheat_sheet.pdf">CSS</a></li>
</ul>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/06/css_cheat_sheet.png"><img class="aligncenter size-medium wp-image-401" title="css_cheat_sheet" src="http://luauf.com/wp-content/uploads/2008/06/css_cheat_sheet-220x300.png" alt="" width="220" height="300" /></a></p>
<p>Vía: <a href="http://www.ilovejackdaniels.com/cheat-sheets/" target="_blank">ILoveJackDaniels</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/06/09/hojas-de-referencia-de-php-mysql-javascript-y-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programar en PHP con NetBeans 6.1</title>
		<link>http://luauf.com/2008/05/11/programar-en-php-con-netbeans-61/</link>
		<comments>http://luauf.com/2008/05/11/programar-en-php-con-netbeans-61/#comments</comments>
		<pubDate>Sun, 11 May 2008 18:02:59 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[IDEs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Netbeans]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=264</guid>
		<description><![CDATA[NetBeans es un conocido IDE para desarrollar en Java, C/C++, Ruby y a partir de ahora: PHP. El IDE de Sun, NetBeans ha lanzado su versión 6.1 y con ella introduce novedades como la integración con MySQL (cosa que era de esperarse luego de la adquisición de MySQL por parte de Sun Microsystems). Además, otra [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://luauf.com/tag/netbeans/">NetBeans</a> es un conocido IDE para desarrollar en Java, C/C++, Ruby y a partir de ahora: PHP. El IDE de Sun, NetBeans ha lanzado su versión 6.1 y con ella introduce novedades como la integración con MySQL (cosa que era de esperarse luego de la adquisición de MySQL por parte de Sun Microsystems).</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-265" title="nb-logo-frontpage" src="http://luauf.com/wp-content/uploads/2008/05/nb-logo-frontpage.gif" alt="" width="210" height="45" /></p>
<p>Además, otra de las novedades es el paquete <a href="http://php.netbeans.org/" target="_blank">Early Access for PHP</a>, mediante el cual, a partir de ahora, se podrá desarrollar en PHP con NetBeans. Este incluye un conjunto de herramientas personalizadas para PHP, como resaltado sintáctico y semántico, templates, completado automático de código, etc. Además, opcionalmente, permite utilizar <a href="http://www.xdebug.org/" target="_blank">Xdebug</a> para debuguear el código.</p>
<p><span id="more-264"></span></p>
<p>Puedes descargar sus 16Mb para cualquier plataforma del <a href="http://download.netbeans.org/netbeans/6.1/final/" target="_blank">sitio oficial</a>, o sus 28Mb para plataforma independiente.</p>
<p>Vía: <a href="http://www.vivaphp.com.ar/" target="_blank">VivaPHP</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/11/programar-en-php-con-netbeans-61/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Utilizar captcha de forma simple</title>
		<link>http://luauf.com/2008/05/10/utilizar-captcha-de-forma-simple/</link>
		<comments>http://luauf.com/2008/05/10/utilizar-captcha-de-forma-simple/#comments</comments>
		<pubDate>Sat, 10 May 2008 04:47:05 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[GD]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=256</guid>
		<description><![CDATA[Secureimage es un script PHP libre y open source para generar imágenes complejas y códigos captcha para proteger los formularios de abuso y de spam. Secureimage requiere de un servidor web capaz de interpretar PHP con soporte para GD. Su uso es muy sencillo, por algo sus creadores destancan, entre muchas otras características más: Muestra [...]]]></description>
			<content:encoded><![CDATA[<p>Secureimage es un script PHP libre y open source para generar imágenes complejas y códigos captcha para proteger los formularios de abuso y de spam.</p>
<p style="text-align: center;"><img class="alignnone size-medium wp-image-257" title="securimage" src="http://luauf.com/wp-content/uploads/2008/05/securimage.jpg" alt="" width="234" height="83" /></p>
<p><span id="more-256"></span></p>
<p>Secureimage requiere de un servidor web capaz de interpretar PHP con soporte para GD.</p>
<p>Su uso es muy sencillo, por algo sus creadores destancan, entre muchas otras características más:</p>
<ul>
<li>Muestra una imagen en solo tres líneas de código</li>
<li>Valida los campos enviados en menos de seis líneas</li>
</ul>
<p>Veamos un pequeño ejemplo, basada en la <a href="http://www.phpcaptcha.org/documentation/quickstart/" target="_blank">Quickstart Guide</a> oficial:</p>
<p><code>
<div class="syntax_hilite">
<div id="php-8">
<div class="php"><span style="color:#000000; font-weight:bold;">&lt;?php</span><br />
<a href="http://www.php.net/session_start"><span style="color:#000066;">session_start</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#616100;">include_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'securimage/securimage.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$securimage</span> = <span style="color:#000000; font-weight:bold;">new</span> Securimage<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Enviar'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$securimage</span>-&gt;<span style="color:#006600;">check</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'captcha_code'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Codigo incorrecto.'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Captcha Ok.'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#000000; font-weight:bold;">?&gt;</span></p>
<p>&lt;html&gt;<br />
&nbsp; &nbsp; &lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;Test CAPTCHA Securimage&lt;/title&gt;<br />
&nbsp; &nbsp; &lt;/head&gt;</p>
<p>&nbsp; &nbsp; &lt;body&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;img id=<span style="color:#FF0000;">"captcha"</span> src=<span style="color:#FF0000;">"securimage/securimage_show.php"</span> alt=<span style="color:#FF0000;">"CAPTCHA Image"</span> /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;a href=<span style="color:#FF0000;">"#"</span> onclick=<span style="color:#FF0000;">"document.getElementById('captcha').src = 'securimage/securimage_show.php?' + Math.random(); return false"</span>&gt;Recargar&lt;/a&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/p&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;form action=<span style="color:#FF0000;">"&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"</span> method=<span style="color:#FF0000;">"POST"</span>&gt;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type=<span style="color:#FF0000;">"text"</span> name=<span style="color:#FF0000;">"captcha_code"</span> size=<span style="color:#FF0000;">"10"</span> maxlength=<span style="color:#FF0000;">"6"</span> /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=<span style="color:#FF0000;">"submit"</span> name=<span style="color:#FF0000;">"Enviar"</span> value=<span style="color:#FF0000;">"Enviar"</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/form&gt;<br />
&nbsp; &nbsp; &lt;/body&gt;</p>
<p>&lt;/html&gt;</p></div>
</div>
</div>
<p>
</code><br />
Para correr el ejemplo, debemos alojar el archivo anterior en un servidor web, y en el mismo path, el directorio secureimage que contiene la descarga de Secureimage, <a href="http://www.phpcaptcha.org/latest.tar.gz" target="_blank">Securimage 1.0.3.1 (tar.gz)</a> o<br />
<a href="http://www.phpcaptcha.org/latest.zip" target="_blank">Securimage 1.0.3.1 (zip)</a></p>
<p>Vía: <a href="http://www.webintenta.com/securimage-utilizar-captcha-de-una-manera-sencilla.html" target="_blank">Intenta</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/10/utilizar-captcha-de-forma-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Obtener URL completa y parsearla en PHP</title>
		<link>http://luauf.com/2008/04/22/obtener-url-completa-y-parsearla-en-php/</link>
		<comments>http://luauf.com/2008/04/22/obtener-url-completa-y-parsearla-en-php/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 01:37:53 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=176</guid>
		<description><![CDATA[Publico un sencillo ejemplo de código en PHP donde: Se obtiene la URL completa de la página del script Se parsea la URL obtenida &#60;?php /** &#160;* Via: &#160;* http://dev.kanngard.net/Permalinks/ID_20050507183447.html &#160;* &#160;*/ function getUrl&#40;&#41; &#123; &#160; &#160; $s = empty&#40;$_SERVER&#91;"HTTPS"&#93;&#41; ? '' : &#40;$_SERVER&#91;"HTTPS"&#93; == "on"&#41; ? "s" : ""; &#160; &#160; $protocol = strleft&#40;strtolower&#40;$_SERVER&#91;"SERVER_PROTOCOL"&#93;&#41;, [...]]]></description>
			<content:encoded><![CDATA[<p>Publico un sencillo ejemplo de código en PHP donde:</p>
<ul>
<li>Se obtiene la URL completa de la página del script</li>
<li>Se parsea la URL obtenida</li>
</ul>
<p><span id="more-176"></span></p>
<p><code></p>
<div class="syntax_hilite">
<div id="php-10">
<div class="php"><span style="color:#000000; font-weight:bold;">&lt;?php</span></p>
<p><span style="color:#008000;">/**<br />
&nbsp;* Via:<br />
&nbsp;* http://dev.kanngard.net/Permalinks/ID_20050507183447.html<br />
&nbsp;*<br />
&nbsp;*/</span><br />
<span style="color:#000000; font-weight:bold;">function</span> getUrl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color:#0000FF;">$s</span> = <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTPS"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#FF0000;">''</span> : <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTPS"</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#FF0000;">"on"</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#FF0000;">"s"</span> : <span style="color:#FF0000;">""</span>;<br />
&nbsp; &nbsp; <span style="color:#0000FF;">$protocol</span> = strleft<span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strtolower"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"SERVER_PROTOCOL"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">"/"</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#0000FF;">$s</span>;<br />
&nbsp; &nbsp; <span style="color:#0000FF;">$port</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"SERVER_PORT"</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#FF0000;">"80"</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#FF0000;">""</span> : <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">":"</span>.<span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"SERVER_PORT"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$protocol</span> . <span style="color:#FF0000;">"://"</span> . <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'SERVER_NAME'</span><span style="color:#006600; font-weight:bold;">&#93;</span> . <span style="color:#0000FF;">$port</span> . <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'REQUEST_URI'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p><span style="color:#000000; font-weight:bold;">function</span> strleft<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$s1</span>, <span style="color:#0000FF;">$s2</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$s1</span>, <span style="color:#CC66CC;">0</span>, <a href="http://www.php.net/strpos"><span style="color:#000066;">strpos</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$s1</span>, <span style="color:#0000FF;">$s2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p>
<span style="color:#008000;">/**<br />
&nbsp;* Via:<br />
&nbsp;* http://www.seraphinux.com/index.php/71/2008/04/22/php-parsear-una-url/<br />
&nbsp;*<br />
&nbsp;*/</span><br />
<span style="color:#0000FF;">$url</span> = getUrl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$datos</span> = <a href="http://www.php.net/parse_url"><span style="color:#000066;">parse_url</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$datos</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$key</span>=&gt;<span style="color:#0000FF;">$value</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"$key: $value &lt;br&nbsp; &gt;"</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</div>
</div>
<p>
</code></p>
<p>Vía: <a href="http://dev.kanngard.net/Permalinks/ID_20050507183447.html" target="_blank">dev.kanngard.net</a></p>
<p>Vía: <a href="http://www.seraphinux.com/index.php/71/2008/04/22/php-parsear-una-url/" target="_blank">Seraphinux</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/04/22/obtener-url-completa-y-parsearla-en-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

