<?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>Tierra0</title>
	<atom:link href="http://www.tierra0.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tierra0.com</link>
	<description>Es intentando lo imposible como se consigue lo posible</description>
	<lastBuildDate>Fri, 04 Dec 2009 01:04:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>En defensa de los derechos fundamentales en internet</title>
		<link>http://www.tierra0.com/2009/12/04/en-defensa-de-los-derechos-fundamentales-en-internet/</link>
		<comments>http://www.tierra0.com/2009/12/04/en-defensa-de-los-derechos-fundamentales-en-internet/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 01:04:07 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=338</guid>
		<description><![CDATA[Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de internet manifestamos nuestra firme oposición al proyecto, y declaramos que: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm3.static.flickr.com/2664/4156943188_7f2d33a87a_o.png" height="128" alt="Derechos de internet" style="float:right; margin:5px;"/>Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de internet manifestamos nuestra firme oposición al proyecto, y declaramos que:</p>
<ol>
<li><strong>Los derechos de autor no pueden situarse por encima de los derechos fundamentales de los ciudadanos,</strong> como el derecho a la privacidad, a la seguridad, a la presunción de inocencia, a la tutela judicial efectiva y a la libertad de expresión. </li>
<li><strong>La suspensión de derechos fundamentales es y debe seguir siendo competencia exclusiva del poder judicial. Ni un cierre sin sentencia.</strong> Este anteproyecto, en contra de lo establecido en el <a href="http://narros.congreso.es/constitucion/constitucion/indice/sinopsis/sinopsis.jsp?art=20&amp;tipo=2">artículo 20.5 de la Constitución</a>, pone en manos de un órgano no judicial -un organismo dependiente del ministerio de Cultura-, la potestad de impedir a los ciudadanos españoles el acceso a cualquier página web. </li>
<li><strong>La nueva legislación creará inseguridad jurídica en todo el sector tecnológico español,</strong> perjudicando uno de los pocos campos de desarrollo y futuro de nuestra economía, entorpeciendo la creación de empresas, introduciendo trabas a la libre competencia y ralentizando su proyección internacional. </li>
<li><strong>La nueva legislación propuesta amenaza a los nuevos creadores y entorpece la creación cultural.</strong> Con Internet y los sucesivos avances tecnológicos se ha democratizado extraordinariamente la creación y emisión de contenidos de todo tipo, que ya no provienen prevalentemente de las industrias culturales tradicionales, sino de multitud de fuentes diferentes. </li>
<li><strong>Los autores, como todos los trabajadores, tienen derecho a vivir de su trabajo con nuevas ideas creativas,</strong> modelos de negocio y actividades asociadas a sus creaciones. Intentar sostener con cambios legislativos a una industria obsoleta que no sabe adaptarse a este nuevo entorno no es ni justo ni realista. Si su modelo de negocio se basaba en el control de las copias de las obras y en Internet no es posible sin vulnerar derechos fundamentales, deberían buscar otro modelo. </li>
<li><strong>Consideramos que las industrias culturales necesitan para sobrevivir alternativas modernas, eficaces, creíbles y asequibles</strong> y que se adecuen a los nuevos usos sociales, en lugar de limitaciones tan desproporcionadas como ineficaces para el fin que dicen perseguir. </li>
<li><strong>Internet debe funcionar de forma libre y sin interferencias políticas</strong> auspiciadas por sectores que pretenden perpetuar obsoletos modelos de negocio e imposibilitar que el saber humano siga siendo libre. </li>
<li><strong>Exigimos que el Gobierno garantice por ley la <a href="http://es.wikipedia.org/wiki/Neutralidad_de_red">neutralidad de la Red</a>, en España</strong> ante cualquier presión que pueda producirse, como marco para el desarrollo de una economía sostenible y realista de cara al futuro. </li>
<li><strong>Proponemos una verdadera reforma del derecho de propiedad intelectual</strong> orientada a su fin: devolver a la sociedad el conocimiento, promover el dominio público y limitar los abusos de las entidades gestoras. </li>
<li><strong>En democracia las leyes y sus modificaciones deben aprobarse tras el oportuno debate público y habiendo consultado previamente a todas las partes implicadas.</strong> No es de recibo que se realicen cambios legislativos que afectan a derechos fundamentales en una ley no orgánica y que versa sobre otra materia. </li>
</ol>
<p><em>Este manifiesto, elaborado de forma conjunta por varios autores, es de todos y de ninguno. Se ha publicado en multitud de sitios web. Si estás de acuerdo y quieres sumarte a él, difúndelo por Internet.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/12/04/en-defensa-de-los-derechos-fundamentales-en-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>eMule: nuevos servidores y correcciones de velocidad</title>
		<link>http://www.tierra0.com/2009/10/18/emule-nuevos-servidores-y-correcciones-de-velocidad/</link>
		<comments>http://www.tierra0.com/2009/10/18/emule-nuevos-servidores-y-correcciones-de-velocidad/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 15:36:41 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=311</guid>
		<description><![CDATA[Por peticiones on y off-line os dejo más instrucciones sencillas para poder tener una mejor búsqueda de archivos, descarga mas rápida y mas servidores validos. Lista de servidores actualizados: Seleccionar todas las direcciones y copiarlas. http://www.gruk.org/server.met http://www.peerates.net/servers.php http://usuarios.lycos.es/guillespi/server.met http://www.peerates.net/servers.php http://www.picsystems.net/emule/servermet/all_server.met Hacer click en en Preferencias > Servidor > Editar... En la ventana del block de [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img165.imageshack.us/img165/9604/amulehv9.png" alt="eMule" style="float:right; margin:5px;" />Por peticiones on y off-line os dejo más instrucciones sencillas para poder tener una mejor búsqueda de archivos, descarga mas rápida y mas servidores validos.</p>
<p><b>Lista de servidores actualizados:</b></p>
<ol>
<li>Seleccionar todas las direcciones y copiarlas.<br />
<a href="ed2k://|serverlist|http://www.gruk.org/server.met|/">http://www.gruk.org/server.met</a><br />
<a href="ed2k://|serverlist|http://www.peerates.net/servers.php|/">http://www.peerates.net/servers.php</a><br />
<a href="ed2k://|serverlist|http://usuarios.lycos.es/guillespi/server.met|/">http://usuarios.lycos.es/guillespi/server.met</a><br />
<a href="ed2k://|serverlist|http://www.peerates.net/servers.php|/">http://www.peerates.net/servers.php</a><br />
<a href="ed2k://|serverlist|http://www.picsystems.net/emule/servermet/all_server.met|/">http://www.picsystems.net/emule/servermet/all_server.met</a></li>
<p><a href="http://farm4.static.flickr.com/3243/3133063467_1909d842cf_o.jpg"><img src="http://farm4.static.flickr.com/3243/3133063467_7edc33e745_t.jpg" alt="servidor" style="float:right;margin:15px;" /></a></p>
<li>Hacer click en en  <code>Preferencias</code> > <code>Servidor</code> > <code>Editar...</code></li>
<li>En la ventana del block de notas que aparece <code>borrar todo el texto</code></li>
<li>pulsar edición > <code>pegar</code></li>
<li>reiniciar el emule</li>
</ol>
<p>Si se prefiere solo añadir puntualmente unos cuantos servidores, se puede hacer click en los enlaces que aparecen arriba.</p>
<p>Otro de los servidores mas famosos que no suele estar dentro de ninguna lista es el creado por TusSeries.com . Se trata de un servidor de emule &#8220;en beta&#8221; pero que funciona realmente bien. Para incluirlo solo hay que hacer click en el siguiente enlace: <a href="ed2k://|server|91.121.6.117|4661|/">servidor de emule de TusSeries</a>.</p>
<p><b>Tablas de velocidad</b><br />
Para alcanzar la mejor velocidad de emule hay que cambiar algunos parámetros de velocidad. Los pasos son los siguientes.<br />
hacemos el <a href="http://www.adsl4ever.com/test/11/">Test de velocidad</a> para ver que velocidad alcanza realmente nuestra linea.<br />
Según los resultados cambiamos los valores por los de la tabla siguiente.<br />
(Situar la flecha encima de los textos subrayados de la tabla para obtener información adicional de la configuración.)</p>
<table width="100%">
<tr>
<td>Velocidad</td>
<td><abbr title="Para test que rondan los 700 o 800 kbps de bajada y 200 - 220 kbps de subida">1MB / 300 kbps</abbr></td>
<td><abbr title="Si la velocidad que tienes es superior a 1600 kbps de bajada">2MB / 300 kbps</abbr></td>
<td>3MB / 300 kbps</abbr></td>
<td><abbr title="En el caso de que tengamos 4 megas de bajada tendremos la ventaja si es ADSL que la subida será mayor, por lo que podremos sacarle mucho más rendimiento al Emule.">4MB / 512 kbps</abbr></td>
<td>6MB</td>
<td>8MB</td>
<td><abbr title="Aprovechando que esta conexión varía en función de la distancia de la que nos encontremos de la central, tendremos muy en cuenta los resultados del Test de Velocidad. En el caso de tener menos de 10 megas conviene fijarse en la configuración que recomendamos para 8 megas. Si por suerte superamos los 12 o 14 megas recomendamos estos valores.">hasta 20 megas con ADSL2+</abbr></td>
</tr>
<tr>
<td>Capacidad Descarga</td>
<td>100 KB/s</td>
<td>204 KB/s</td>
<td>306 KB/s</td>
<td>400 KB/s</td>
<td>612 KB/s</td>
<td>816 KB/s</td>
<td>2040 KB/s</td>
</tr>
<tr>
<td>Límite Descarga</td>
<td>sin límite</td>
<td>sin límite</td>
<td>sin límite</td>
<td>sin límite</td>
<td>sin límite</td>
<td>sin límite</td>
<td>sin límite</td>
</tr>
<tr>
<td>Capacidad Subida</td>
<td>22 KB/s</td>
<td>22 KB/s</td>
<td>22 KB/s</td>
<td>35 KB/s</td>
<td><abbr title="* Usuarios con cable que no tengan 512 kbps de subida deben ajustar la capacidad de subida a su conexión en función de los resultados del test.">45 KB/s</abbr></td>
<td>44 KB/s</td>
<td>70 KB/s</td>
</tr>
<tr>
<td>Límite Subida</td>
<td>22 KB/s</td>
<td>22 KB/s</td>
<td>22 KB/s</td>
<td>45 KB/s</td>
<td>35 KB/s</td>
<td>44 KB/s</td>
<td>70 KB/s</td>
</tr>
<tr>
<td>Tamaño de la cola</td>
<td>5000</td>
<td>5000</td>
<td>5000</td>
<td>5000</td>
<td>5000</td>
<td>5000</td>
<td>5000</td>
</tr>
<tr>
<td>Conexiones máximas</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
</tr>
<tr>
<td>Máx. Fuentes/archivo</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
<td>1000</td>
</tr>
<tr>
<td>Nuevas Conexiones máx.5/seg.</td>
<td>60</td>
<td>60</td>
<td>60</td>
<td>60</td>
<td>60</td>
<td>60</td>
<td>60</td>
</tr>
<tr>
<td>Máx. Conexiones a medio abrir</td>
<td>9</td>
<td>9</td>
<td>9</td>
<td>9</td>
<td>9</td>
<td>9</td>
<td><abbr title="* Si no tienes puesto el parche de Win SP2 tienes que poner 9">50</abbr></td>
</tr>
<tr>
<td colspan="8">(<a href="http://www.testdevelocidad.es/configurar-emule-segun-conexion.html">tabla extraída de testdevelocidad.es</a>)</td>
</tr>
</table>
<p>Es importante tener los puertos abiertos para obtener una buena velocidad, es lo que se suele llamar tener una ID alta.<br />
Al terminar hay que guardar los valores y cerrar el emule para que cargue los datos.</p>
<p><b>Filtro AntiSpam</b><br />
Muchos de los servidores actuales contienen datos de Spam corruptos que impiden que obtengamos resultados al hacer búsquedas.<br />
Para evitar que esto nos pase podemos establecer un filtro que elimine las conexiones malintencionadas y limpie los resultados finales.<br />
para hacer esto tenemos que:<br />
<a href="http://farm3.static.flickr.com/2506/4021913469_268e55dfe4_o.jpg" style="float:right; margin:5px;"><img src="http://farm3.static.flickr.com/2506/4021913469_eb579f7597_t.jpg" alt="Seguridad eMule" /></a></p>
<ol>
<li>Entramos en <code>Preferencias</code> > <code>Seguridad</code>.</li>
<li>En la seccion de Filtrar IP <code>activamos Filtrar servidores</code>.</li>
<li>en <code>Actualizar desde URL</code> borramos el contenido y escribimos </li>
<li><code>http://surfnet.dl.sourceforge.net/sourceforge/emulepawcio/ipfilter.dat</code> y pulsamos el boton cargar.</li>
<li>En caso de no encontrar el boton de cargar reiniciamos el emule.</li>
</ol>
<p>Si todo funciono correctamente, el archivo .dat será actualizado y se borraran automáticamente muchos de los servidores.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/10/18/emule-nuevos-servidores-y-correcciones-de-velocidad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Efecto con jQuery tipo LiveUp</title>
		<link>http://www.tierra0.com/2009/09/07/efecto-con-jquery-tipo-liveup/</link>
		<comments>http://www.tierra0.com/2009/09/07/efecto-con-jquery-tipo-liveup/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 23:46:06 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=297</guid>
		<description><![CDATA[Os acordáis de SuperMario cuando cogía una vida nueva? pues el otro día pensando en como avisar a los usuarios de alertas gráficamente sin abrir alert() o PopUp innecesarios me acorde de eso mismo.. y fruto de esa idea ha salido este código.. Se trata de una función que al ejecutarla muestra una imagen sobre [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm3.static.flickr.com/2658/3893939823_70f7eee097_o.png" alt="estrellas liveUp" style="float:right; margin:3px;" />Os acordáis de SuperMario cuando cogía una vida nueva? pues el otro día pensando en como avisar a los usuarios de alertas gráficamente sin abrir <code>alert()</code> o PopUp innecesarios me acorde de eso mismo.. y fruto de esa idea ha salido este código..</p>
<p>Se trata de una función que al ejecutarla muestra una imagen sobre el elemento indicado, desvaneciéndose y subiendo en un tiempo determinado.</p>
<p>Para ejecutar la función tenemos que poner como primer parámetro el identificador del objeto, ya sea el nombre del tag HTML, del ID o de la clase como en cualquier elemento jQuery es decir, si es un ID con <code>#</code> delante y si es una clase con <code>.</code> delante.<br />
El siguiente parámetro es la dirección de la imagen que queremos que se abra cuando se ejecute la función. El tercer y cuarto valor es respectivamente el alto y ancho de la imagen que vamos a mostrar, el quinto (la variable zenit) es la altura que va a alcanzar la imagen al desaparecer (por defecto esta en 100px). El ultimo valor es el tiempo que tarda en desvanecerse el objeto seleccionado, el tiempo predeterminado es 1 segundo pero si se quiere poner uno hay que ponerlo en <em title="Milisegundos">ms</em> (1s = 1000).</p>
<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showPlainTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> liveUp<span style="color: #66cc66;">&#40;</span>id, img, h, w, zenit, wait<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>img==<span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;&nbsp; &nbsp;img&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #3366CC;">'star.png'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>h==&nbsp; <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;&nbsp; &nbsp;h&nbsp; &nbsp; = <span style="color: #3366CC;">'32'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>w==&nbsp; <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;&nbsp; &nbsp;w&nbsp; &nbsp; = <span style="color: #3366CC;">'32'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>zenit== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; zenit&nbsp; &nbsp;= <span style="color: #CC0000;color:#800000;">50</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>wait== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>&nbsp;&nbsp;wait&nbsp;= <span style="color: #CC0000;color:#800000;">100</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i, domEle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> d&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getTime</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> liveUpId&nbsp; &nbsp; = id+<span style="color: #3366CC;">'_'</span>+i+<span style="color: #3366CC;">'_'</span>+d; <span style="color: #009900; font-style: italic;">//i;'_LiVE_Up'+</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liveUpId&nbsp; &nbsp; &nbsp; &nbsp; = liveUpId.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#'</span>, <span style="color: #3366CC;">'_'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> offset&nbsp; &nbsp; = $<span style="color: #66cc66;">&#40;</span>domEle<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">offset</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> object&nbsp; &nbsp; = <span style="color: #3366CC;">'&lt;img id=&quot;'</span>+liveUpId+<span style="color: #3366CC;">'&quot; src=&quot;'</span>+img+<span style="color: #3366CC;">'&quot; height=&quot;'</span>+h+<span style="color: #3366CC;">'&quot; width=&quot;'</span>+w+<span style="color: #3366CC;">'&quot; /&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>object<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#'</span>+liveUpId<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>opacity: <span style="color: #CC0000;color:#800000;">1</span>.<span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#125;</span>, wait<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'visibility'</span>:<span style="color: #3366CC;">'visible'</span>, <span style="color: #3366CC;">''</span>:<span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'position'</span>:<span style="color: #3366CC;">'absolute'</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'top'</span> <img src='http://www.tierra0.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ffset<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">'top'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #3366CC;">'left'</span>:<span style="color: #66cc66;">&#40;</span>offset<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">'left'</span><span style="color: #66cc66;">&#93;</span>+<span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span>domEle<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #0066FF;">/<span style="color: #CC0000;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>w/</span><span style="color: #CC0000;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>opacity: <span style="color: #CC0000;color:#800000;">0</span>.<span style="color: #CC0000;color:#800000;">0</span>, top: offset<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">'top'</span><span style="color: #66cc66;">&#93;</span>-zenit<span style="color: #66cc66;">&#125;</span>, <span style="color: #CC0000;color:#800000;">1000</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#'</span>+liveUpId<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">remove</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Este código es una función que usa jQuery y jQuery.Easing para ejecutar los efectos base.. ha sido testado en Firefox3, Safari4 y IE7.0.5730.11IC bajo winXP. </p>
<p>A continuación os dejo un ejemplo. Para hacerlo funcionar solo tenéis que guardar con extensión html.</p>
<div class="igBar"><span id="lhtml-4"><a href="#" onclick="javascript:showPlainTxt('html-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-4">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background:gray; color: white;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function liveUp(id, img, h, w, zenit, wait){</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(img==null)&nbsp; &nbsp;&nbsp; &nbsp;img&nbsp; &nbsp; &nbsp; &nbsp; = 'star.png';</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(h==&nbsp; null)&nbsp; &nbsp;&nbsp; &nbsp;h&nbsp; &nbsp; = '32';</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(w==&nbsp; null)&nbsp; &nbsp;&nbsp; &nbsp;w&nbsp; &nbsp; = '32';</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(zenit== null)&nbsp; &nbsp; zenit&nbsp; &nbsp;= 50;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(wait== null)&nbsp;&nbsp;wait&nbsp;= 100;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(id).each(</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function(i, domEle){</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var d&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= new Date().getTime();</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var liveUpId&nbsp; &nbsp; = id+'_'+i+'_'+d; //i;'_LiVE_Up'+</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liveUpId&nbsp; &nbsp; &nbsp; &nbsp; = liveUpId.replace('#', '_');</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var offset&nbsp; &nbsp; = $(domEle).offset();</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var object&nbsp; &nbsp; = '<span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"'+liveUpId+'"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"'+img+'"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"'+h+'"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"'+w+'"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span>';</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('body').append(object);</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#'+liveUpId)</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .animate({opacity: 1.0}, wait)</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .css({'visibility':'visible', '':''})</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .css({'position':'absolute'})</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .css({'top':offset['top'], 'left':(offset['left']+($(domEle).width()/2)-(w/2) )})</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .animate({opacity: 0.0, top: offset['top']-zenit}, 1000, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function (){</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#'+liveUpId).remove();</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //direccion de la imagen... en base64 para que funcione directamente con el archivo</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var url_imagen = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAE1mlDQ1BJQ0MgUHJvZmlsZQAAeJzllWtMk3cUxp/37R2otFCLTNFXxhBZYR2grEII0CEDEbBUoIx09iZUW3jzUhFkUxlG8IYXmMrChhIUlWwuKA4ZzhsToolDzJDhvGA13hBvgwREuw9d5INxyT57Pj15knNyzj/5/R+Af1RH0xYSgDXPxqjiY6lMTRbF6wUXfEjgCU+doYCOSU1NwltrpBcEAFwO0tG0pSlpvulm6/X5vgP6DY+OBxnf3gcAEDKZmiyAoABIcpw6DIBE79SfAZCstNE2gMgGIDHk6owAQQOQMWqVEiBqAYznqFVKgNwNYFyvVikBVjWA8UJDjg1gbwMgzzOa8wD2KYA1yWgqMAC8bgAbDTRjA/jZAIKs1nwjwN8MICBTk0U518xfBygOAqTPhLcEwE85gPTxhDdLBUi9gDbphPd8BggAxCc/FywNDQEAEOI2gO/ncAzVAC6VwMt5DseY2OEY7wE4MqBpumEFU/jvGxUBYMEFXpiNGGhRikPoJ8REClFNDJDh5E7yFYtmDbIZDpuzl5vAfcU7yd8sMLkkuka6zRMqJ2W4F4rqxY88MyU3paVT5nqPTu3w2TojdSbbt92vxD82wH327Q9PB+3/qOrjitDyOZXhexTtEfYoaXR6bP2nL+KXJPQkpST3LbKq3dJbNOZsf+2grs24LceyLMUaTvsVSAp5ReMlT1ffKb2yrqu8deOBLbu3VVSV7KRrzLVL68z1zL6yA983dfw43BzWUtZqb1988trZFZ3S82cuFvdE9gr/HLzWP9B3594D16GYZ1tGnrxY7nC8cbsbpkKOBbDiG3RglJhLrCLOkd6kjexjxbHa2Ar2aU4a5zF3J28+n+B3Cna5MK4ZbvHCmElx7iqRWVzp0SFxnayXnp8S4901VetDTD9C0b6Rfl7+xKyxQMgkwaFybUhV2KVwqUIf0RzFjs6MPRrnE1+VODmpPiVi0Q31loy4LE72xS++0xeYknODl4usw3R/wa+Fe4vXfqlZIysdWXes3Lpx2ubftubu4FU37IquuV67us5v76WG8sbEQ9N+wOHRI4Jjc46vaR88taYjoPPGhcbfyy+XXam7ar+Zdnv4fvfQw7+TRl+8cTsJASR4H+FIRR524Bc8ICgim9hDPCSjyBryJWs5y842sp9yKriB3D7edn6GIMCF4zLkesttQDjoDpGPWOXRKPGe3Oi10Jv3Xve0huklVIpvoJ+HPy9AEOglkwenydeGtIQ9DQ9VFEeciRJGp8fuj0O8MaEnKTH5/CJ12t30rzUffN6tLdNFGsaXnjFXWrT5oYzQdn9l16qDX21am1eWvD5wA3vT1crm7RXVS3YpvvWqHauz1/+xr/tAX9Ojwx7NCS3VrSPtzCnB2aOdyy4EXXT02Hv/6n94Q2LX3D0xGPfk2XDX2AWHw8mqkxDnnwIA90on9PPc15oAnDwDAIsLNJQDi+3AgnNATSLgHwl4GoFUIaBWgLhlADEwE8QDMVgoAvmuUfWukfSu0QM4Mw0AIDIv1Bkopc5i1jM6m+l1DItgxkLoYAAFJXSwwAw9GOhggwnG/2r9f2UzFdkAQJlPFzPmnFwbFUPTFhOlzLfSK2wmRkYl5BmCZVSIXB4KAM7cBQCuCKjNAoATz7RvzP0HbnfbUKLmT0AAAAWISURBVFiF7ZZpbFVFFMd/c+99W1t8t6+bFGmtYBGhxbI0Igr6wS0lGCJI4p6ohGfUiMSkRo11i8ZEosZQNWqNEjQVjdHE7QNBLGgEN6QlgkClQLG0ULu99+4y44d7H310UVuCn5zkn7mZmTPnd+bMzB04jdLWSKS5keDpzKGN17C5kRw7aA5EjJzU6UCMGyAA8fyqZ8mdvgYDfcV45xlXUY3oexvDyrH2K3tgl9q7Qd823rnGtQJ7XJaY59+JrhsYIZOs4svn72sIVvxnAELq8bPOuxlUElSS3Avuww068f8EYGdDsCJcsODKYM5EUDaoFOG8SrRALN7cSM4ZBwjqTjxv5n0gB3wAG4FFbMZqRB+3nFGAfa8S1YKF8Uh+JcgEKNdXggmlV6EJsfKMAlgGd+RXPoAgAcoC5XiSSYxQDtmTay7a/QbzxzKnSH/set14XkgZR4jI6LgBym/YhGEoUDLDXIEWpL/zAL9/dtM/uFTHlKvVz1zlPHYS4IfXWFRQtnjzpCteAqfdiwoNhAbo/rfutbt+7k/248EIQARBC/s2LiC9Wvm1FkIJk98/u5VE+/YZM1bRMrgCLxvPmzOXP1A8ZxlYh7zcCgNEAAiAFgQMv80YBAPPkXJ8Zw5gg7R8UNtrEwFUqISDm1+gv7XpiZn3eCugpwHWfSq/vH12Sz4Bszq7cArYx7xo0xNJezDnys6oLe8+kAnvZMh+cPu9WvaB2+cFE5zI4W/X07N309qKe52Hhu2BdPnxRW3d5EW18djkiZBo9fIrQt7yisCpQvP605ErxweyQaa8b6FBVjntu76h8/v1L85a7dyf6U8fCnDX5aqpp21rNFQ0f15kQg5Yx7woZDJDfrRuX4Z6h0sBkTI69rZwdPsb9VWr3XuH+hu2AgA/Pxkuc7Pcp869ctWNZnA79Oz0IjrFMr0HlLfEqFP79Sww59HRVcaRrxvqZz8o7x7J14j3wKxHkwekbde3fvEqPf1loJneps6U44Jjg+OAq4b3G4V0dhZxZEtDvXTlsyP5GRUAYG4tTdJ16q2UBjIIDmMT2ST+7ENK/Ze5tRwcMwCAknpNtDAKqZ7hEf6Tkt1Ei0tQStb8nY9RAb59IjAnq3BqScA6DKm+sQMkjjMh2wICNc11oz/ZRgWQrlqWW34J9LZ6+R4rgJVE9B8iu2gavVA9ZgAhqInmhaHviHejZgoDQkWQWwVmJQTyQOlDxinoP0x0yhykMkZNw4gAW+q4MBIrqchSHYhkD8LFk9QRgQJEwQISBcv4rfUsDrQXY01agcirRhgxhNQGx/e2Y+Zlg8uoAMaIjSltSe60i6F7D9iOd+ZDJuROJ5kzi0Mtv3Ls53W/KES9cN1ox0/BZwpnX83k8hUEur/37Kw/IdlDljiBEZlQ8Xndidg1dRz/VwBKaEtjRTE42g7BGJjTSJlVHNq9n44fX0G5zpoFz8i16fHNdcm1h7d9UtvxQ/jxs6sXc07ZRRjHd0D3PuhtIzplLtbOTdeAu2GoLzGk1j6Ih0tLS2P75iy9Drp2YUdn0banjT92fMHxE87Tt7/lrOsc8HaCb5e+AtWl5xF6aLFxf54ZWV186VKKJ4XRrS467RJ2b3z5vYXP2Tf749PCyHBuACFDs643y6txcqto29PF0U8b2HnAWl/7vv1htwXAJXj/EJFhKwHZtB+35iXnqxnFvTvWHHx3yfTS7BXnLFpOfuXstF02kMK7qiSgRMZEOhB+8zZ9cfVl8zb0tLbw68HEO7Ub7Y1/DCCAgA+pM/gYyHgS4T8ITt6F9sKpenTlQu3qqaXRW1wrwcMf9U/c3MyJoQBkQGiAvnGlfu3bze53H28lNYLD9B906AnKPIT+P9rTI1dhdg3QXd9En992MgX/l78AHOafiFf1JHkAAAAASUVORK5CYII='; &nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">&lt;b</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"estrella"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"liveUp('#estrella', url_imagen, 20, 20)"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pulsa aqui para ver como sale una estrella de 20px por 20px</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/b&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">&lt;b</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"logo"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"liveUp('#logo', 'http://www.tierra0.com/wp-content/themes/satori/images/LogoTierra0-2.gif', 100, 200, null, 200)"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pulsa aqui para ver como sale el logo de google pero mucho mas lento</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/b&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>Ejemplo creado en tierra0.com, mas info en <span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://www.tierra0.com/2009/09/07/efecto-con-jquery-tipo-liveup/"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>tutorial de liveUp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Para problemas ruegos y preguntas los comentarios, y para donaciones, invitadme a un café <img src='http://www.tierra0.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/09/07/efecto-con-jquery-tipo-liveup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Función de extracción de datos Youtube() en PHP version4</title>
		<link>http://www.tierra0.com/2009/07/06/funcion-de-extraccion-de-datos-youtube-en-php-version4/</link>
		<comments>http://www.tierra0.com/2009/07/06/funcion-de-extraccion-de-datos-youtube-en-php-version4/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 21:07:02 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=279</guid>
		<description><![CDATA[Continuo con el desarrollo de una nueva versión de esta función que tan famosa parece estarse haciendo.. como todo el mundo sabe su funcionamiento es muy sencillo, se le pasa una variable que puede ser la URL de un video de youtube o su ID y da como resultado un montón de datos sobre el [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img82.imageshack.us/img82/681/youtubephpdg8.jpg" alt="LogoYoutubePHP" style="float:right;" />Continuo con el desarrollo de una nueva versión de esta función que tan famosa parece estarse haciendo.. como todo el mundo sabe su funcionamiento es muy sencillo, se le pasa una variable que puede ser la URL de un video de youtube o su ID y da como resultado un montón de datos sobre el video ordenados dentro de un array, teniendo un segundo parámetro que podemos activar en caso de error y que nos facilita información interna sobre la función..</p>
<p>Esta 4º versión de la función ha salido sobre todo gracias al generoso "cafe" al que me ha invitado <a href="http://www.tierra0.com/2009/02/13/funcion-de-extraccion-de-datos-youtube-en-php-version3/comment-page-1/#comment-1221">@Tx</a> y a los apuntes sobre errores que ha encontrado <a href="http://www.tierra0.com/2009/02/13/funcion-de-extraccion-de-datos-youtube-en-php-version3/comment-page-1/#comment-1316">@Nach</a> en los textos con acentos y similares. De modo que el funcionamiento general de la función es exactamente el mismo.</p>
<p>La otra novedad que tiene esta actualización es el modo en que se realiza la petición de datos, ya que ahora lo hace prácticamente a la misma velocidad pero indicando a youtube que somos un navegador firefox, de manera que así obtendremos los mismos datos que un navegador web normal a su misma velocidad.<br />
Esta modificación se encuentra entre las lineas 9 y 23 de manera que si alguien tiene problemas con esta nueva manera de obtener los datos o encuentra que tiene un consumo de memoria o de tiempo mayor puede volver al modo anterior solo sustituyendo ese párrafo por <code>query = @file_get_contents($url);</code>.</p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> youtube<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</span>, <span style="color: #0000ff;">$debug</span> = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$_id</span> = <a href="http://www.php.net/parse_url"><span style="color: #000066;">parse_url</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/parse_str"><span style="color: #000066;">parse_str</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_id</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'query'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_id</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$id</span> = <a href="http://www.php.net/empty"><span style="color: #000066;">empty</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$id</span> : <span style="color: #0000ff;">$v</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = <span style="color: #ff0000;">'http://es.youtube.com/watch?v='</span>.<span style="color: #0000ff;">$id</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Obtencion de los datos desde la web // // //</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//&nbsp; (si esta parte te resulta demasiado lenta sustitullela por $query = @file_get_contents($url);</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$cookie</span> = <a href="http://www.php.net/tempnam"><span style="color: #000066;">tempnam</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"/tmp"</span>, <span style="color: #ff0000;">"YOUTUBE"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$user_agent</span> = <span style="color: #ff0000;">'Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$c</span>&nbsp; =&nbsp;curl_init<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_COOKIEJAR,&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_COOKIEFILE,&nbsp; &nbsp; <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_FOLLOWLOCATION,&nbsp; <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// no sigue las redirecciones</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_HEADER,&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// no mostrar el header denro de la salida</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_RETURNTRANSFER,&nbsp; <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span>,&nbsp;CURLOPT_USERAGENT,&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$user_agent</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$query</span>=&nbsp;curl_exec<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$c</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// // // // // // // // // // // // // // // //</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">'!&amp;t=(.+)&amp;!U'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$t</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>title<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;!U"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$titulo</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>description<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;!U"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$descripcion</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;span class=<span style="color: #000099; font-weight: bold;">\"</span>watch-video-added post-date<span style="color: #000099; font-weight: bold;">\"</span>&gt;(.+) de (.+) de (.+)&lt;/span&gt;!U"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>keywords<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!href=<span style="color: #000099; font-weight: bold;">\"</span>/user/(.+)<span style="color: #000099; font-weight: bold;">\"</span>!U"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$user</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$t</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$t</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$titulo</span>&nbsp;&nbsp;&nbsp;= <span style="color: #0000ff;">$titulo</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$descripcion</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$descripcion</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$fecha</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>&amp;&amp;<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>&amp;&amp;<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">' de '</span>.<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">' de '</span>.<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$tags</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$user</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$user</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"id"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$id</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"t"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"url"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$url</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"iurl"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #ff0000;">"http://img.youtube.com/vi/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"/2.jpg"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"reproductor"</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <span style="color: #ff0000;">"http://www.youtube.com/p.swf?video_id="</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"&amp;iurl=http://img.youtube.com/vi/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"/2.jpg&amp;t="</span>.<span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"video"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #ff0000;">"http://youtube.com/get_video.php?video_id="</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"&amp;t="</span>.<span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"html"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #ff0000;">"&lt;object width=<span style="color: #000099; font-weight: bold;">\"</span>425<span style="color: #000099; font-weight: bold;">\"</span> height=<span style="color: #000099; font-weight: bold;">\"</span>350<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;param name=<span style="color: #000099; font-weight: bold;">\"</span>movie<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>http://www.youtube.com/v/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/param&gt;&lt;param name=<span style="color: #000099; font-weight: bold;">\"</span>wmode<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>transparent<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/param&gt;&lt;embed src=<span style="color: #000099; font-weight: bold;">\"</span>http://www.youtube.com/v/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\"</span> type=<span style="color: #000099; font-weight: bold;">\"</span>application/x-shockwave-flash<span style="color: #000099; font-weight: bold;">\"</span> wmode=<span style="color: #000099; font-weight: bold;">\"</span>transparent<span style="color: #000099; font-weight: bold;">\"</span> width=<span style="color: #000099; font-weight: bold;">\"</span>425<span style="color: #000099; font-weight: bold;">\"</span> height=<span style="color: #000099; font-weight: bold;">\"</span>350<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/embed&gt;&lt;/object&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"title"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/utf8_decode"><span style="color: #000066;">utf8_decode</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/html_entity_decode"><span style="color: #000066;">html_entity_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$titulo</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <a href="http://www.php.net/utf8_decode"><span style="color: #000066;">utf8_decode</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/html_entity_decode"><span style="color: #000066;">html_entity_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$descripcion</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"fecha"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$fecha</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"tags"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <a href="http://www.php.net/utf8_decode"><span style="color: #000066;">utf8_decode</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/html_entity_decode"><span style="color: #000066;">html_entity_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"usuario"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <a href="http://www.php.net/utf8_decode"><span style="color: #000066;">utf8_decode</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/html_entity_decode"><span style="color: #000066;">html_entity_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$user</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//sistema de diagnostico</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'debug'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$query</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'la url de lectura es'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$url</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'lectura de video'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span>&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'t encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$t</span>&nbsp;&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'titulo encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$titulo</span>&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'descripcion encontrada'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$descripcion</span>&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fecha encontrada'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fecha</span>&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tags encontrados'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tags</span>&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>&nbsp;? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'usuario encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$user</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'contenido para debug'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$salida</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>&nbsp; <span style="color: #0000ff;">$s</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$t</span> == <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//Error de conexion</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// todo OK</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$salida</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esta función responde un array con las variables del video siempre que el video no haya sido borrado, caso en el que devuelve false.<br />
Un ejemplo practico.</p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$datos</span> = youtube<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://es.youtube.com/watch?v=aWCD69urAqQ&amp;fmt=18'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$datos</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$datos</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$nombres</span> =&gt; <span style="color: #0000ff;">$valor</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$nombre</span>.<span style="color: #ff0000;">' = '</span>.<span style="color: #0000ff;">$valor</span>.<span style="color: #ff0000;">"&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'el video que intentaba ver no existe'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si aun queda algún error solo tenéis que comentarlo ah!, y las donaciones/cafés son bienvenidas <img src='http://www.tierra0.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/07/06/funcion-de-extraccion-de-datos-youtube-en-php-version4/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Ejemplo de upload simple para uno o varios archivos</title>
		<link>http://www.tierra0.com/2009/04/16/ejemplo-de-upload-simple-para-uno-o-varios-archivos/</link>
		<comments>http://www.tierra0.com/2009/04/16/ejemplo-de-upload-simple-para-uno-o-varios-archivos/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 12:13:01 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=268</guid>
		<description><![CDATA[Dado que me comentaron aun con el ultimo post que no se aclaraban muy bien como subir archivos esta vez no voy a poner una función si no un código de ejemplo para subir uno o varios archivos a nuestro servidor. El código es muy fácil y esta muy comentado así que espero que no [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3582/3447496798_722c4b128e_o.png" alt="rocketFile" style="float:right" />Dado que me comentaron aun con el ultimo post que no se aclaraban muy bien como subir archivos esta vez no voy a poner una función si no un código de ejemplo para subir uno o varios archivos a nuestro servidor.<br />
El código es muy fácil y esta muy comentado así que espero que no haya ningún problema en seguirlo o modificarlo.<br />
Se trata de un formulario muy simple con una caja para subir el archivo y un botón de enviar. Se puede modificar y poner todas las cajas que queramos para subir todos los archivos que queramos. Como plus le he incorporado una sentencia que hace que si esa caja esta vacía no se envíe el formulario hasta que se complete.</p>
<p>la segunda parte hace una comprobación de si se ha enviado algún archivo para subir, si es así no pone nuestro formulario y en vez de eso pone todos los datos que podemos obtener de la subida del archivo. Si se ha enviado un archivo para subir pero ocurrió algún error, nos lo indicara también. En caso de no haber enviado nada pondrá el formulario.</p>
<p>Cada <code>echo</code> la lista de echo seguidos de comentarios son todas las variables que podemos usar en nuestro script. En caso de subir varios archivos a la vez este apartado se duplicara por cada archivo subido.</p>
<div class="igBar"><span id="lphp-10"><a href="#" onclick="javascript:showPlainTxt('php-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-10">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;head&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;&lt;/title&gt;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/head&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;body&gt;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//formulario simple para subir el archivo (a traves de este mismo archivo)</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fomulario</span> = <span style="color: #ff0000;">'&lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; onsubmit=&quot;return (this.archivo.value!=<span style="color: #000099; font-weight: bold;">\'</span><span style="color: #000099; font-weight: bold;">\'</span>)&quot;&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=&quot;file&quot; name=&quot;archivo&quot;/&gt;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button type=&quot;submit&quot;&gt;Subir a la web&lt;/button&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/form&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//direccion donde queremos dejar el archivo</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$path</span> = <span style="color: #ff0000;">'./'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//si se ha enviado uno o varios archivos no ponemos el formulario</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/count"><span style="color: #000066;">count</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_FILES</span><span style="color: #66cc66;">&#41;</span>&gt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//obtenemos todos los archivos uno por uno</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_FILES</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$name</span> =&gt; <span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//comprobamos que esten en la carpeta que nosotros queremos</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/move_uploaded_file"><span style="color: #000066;">move_uploaded_file</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span>,<span style="color: #0000ff;">$path</span>.<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El archivo ha sido subido correctamente.&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Otros datos del archivo:&lt;br/&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Nombre del objeto del formulario: '</span>.&nbsp; &nbsp; <span style="color: #0000ff;">$name</span>.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Nombre original del archivo: '</span>.&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span>.&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Tipo de archivo: '</span>.&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'type'</span><span style="color: #66cc66;">&#93;</span>.&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Nombre del archivo temporal: '</span>.&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span>.&nbsp; &nbsp;<span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Error producido al subir el archivo: '</span>.&nbsp; &nbsp;<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'error'</span><span style="color: #66cc66;">&#93;</span>.&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Tama&amp;ntilde;o del archivo: '</span>.&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'size'</span><span style="color: #66cc66;">&#93;</span>.&nbsp;&nbsp;<span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//si no estan en la carpeta que nosotros queremos</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Ha ocurrido un error.&lt;br/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//muestra el formulario si no se ha realizado ningun envio de archivo</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$fomulario</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/body&gt;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El método de uso es muy sencillo. Copia el código de arriba, crea un archivo con extensión <code>php</code>, pega el codigo dentro y guardalo.<br />
Una vez realizado esto solo tienes que cambiar el texto asociado a la variable <code>$path</code> de la linea 14 y poner la dirección de donde quieres que se guarden los archivos una vez en el servidor.<br />
<ins datetime="2009-07-06T20:40:06+00:00">Un usuario "anónimo" ha echo un aporte a este articulo indicando que la función <code><a href="http://es.php.net/copy">copy()</a></code> no es la mas adecuada para este tipo de casos aun que sea la mas extendida entre los ejemplos. La mas adecuada es <code><a href="http://es.php.net/move_uploaded_file">move_uploaded_file()</a></code> como vemos en la linea 22 que realiza una comprobación previa de que el archivo que va a mover ha sido enviado por HTTP POST desde un formulario, y no es un archivo de dentro de nuestro servidor, evitando de esta manera problemas de seguridad.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/04/16/ejemplo-de-upload-simple-para-uno-o-varios-archivos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>vimeo_upload(), sube vídeos a vimeo desde tu servidor con PHP</title>
		<link>http://www.tierra0.com/2009/04/01/vimeo_upload-sube-videos-a-vimeo-desde-tu-servidor-con-php/</link>
		<comments>http://www.tierra0.com/2009/04/01/vimeo_upload-sube-videos-a-vimeo-desde-tu-servidor-con-php/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 18:59:03 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Online]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=251</guid>
		<description><![CDATA[Si como a mi os gusta mas vimeo que youtube ya sea por su diseño, facilidad de uso o mayores capacidades de personalización (como la capacidad de descargar los vídeos directamente, personalización de thumbnails...) estáis de enhorabuena.. El siguiente código es capaz de subir vídeos directamente desde nuestro servidor a vimeo agregando titulo, descripción, tags [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3582/3404373528_5158261ba5_o.png" alt="upload_vimeo" style="float:right;" />Si como a mi os gusta mas <a href="http://www.vimeo.com/">vimeo</a> que <a href="http://www.youtube.com/">youtube</a> ya sea por su diseño, facilidad de uso o mayores capacidades de personalización (como la capacidad de descargar los vídeos directamente, personalización de thumbnails...) estáis de enhorabuena.. </p>
<p>El siguiente código es capaz de subir vídeos directamente desde nuestro servidor a vimeo agregando titulo, descripción, tags y permisos de acceso. Para hacer esto y cumpliendo una <a href="http://www.tierra0.com/2009/03/27/source_extract-version2-envio-y-extraccion-de-datos-desde-php-como-si-fuera-un-navegador/">pasada promesa, utilizaremos <code>source_extract()</code></a> así que es necesario que esta función también esté en el mismo archivo.</p>
<div class="igBar"><span id="lphp-13"><a href="#" onclick="javascript:showPlainTxt('php-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-13">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> vimeo_upload<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$file</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$mail</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$pass</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$title</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$descripcion</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$tags</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$permisos</span>=<span style="color: #000000; font-weight: bold;">false</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_key</span>=<span style="color: #ff0000;">'e1dfce4136d69d7f99d2a4d00c4a0d71'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_secret</span>=<span style="color: #ff0000;">'e9ff591b0'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @<a href="http://www.php.net/set_time_limit"><span style="color: #000066;">set_time_limit</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$title</span>&nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/htmlentities"><span style="color: #000066;">htmlentities</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$title</span>,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENT_NOQUOTES, <span style="color: #ff0000;">'UTF-8'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$descripcion</span>&nbsp; &nbsp; = <a href="http://www.php.net/htmlentities"><span style="color: #000066;">htmlentities</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$descripcion</span>, &nbsp; &nbsp;ENT_NOQUOTES, <span style="color: #ff0000;">'UTF-8'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$cookie</span> &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/tempnam"><span style="color: #000066;">tempnam</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"/tmp"</span>, <span style="color: #ff0000;">"VIMEO"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_login_url</span>&nbsp; = <span style="color: #ff0000;">"http://www.vimeo.com/log_in"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_rest_url</span>&nbsp; &nbsp;= <span style="color: #ff0000;">"http://www.vimeo.com/api/rest/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_auth_url</span>&nbsp; &nbsp;= <span style="color: #ff0000;">"http://www.vimeo.com/services/auth/"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$api_upload_url</span>&nbsp;= <span style="color: #ff0000;">"http://www.vimeo.com/services/upload/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#login</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'sign_in[email]'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$mail</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'sign_in[password]'</span>&nbsp;=&gt; <span style="color: #0000ff;">$pass</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$login</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_login_url</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#frob</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <span style="color: #0000ff;">$_args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'perms'</span>&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">'write'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$frob</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_auth_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$frob</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Location'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//si aun no fue aceptada la autorizacion</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$frob</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_auth_url</span>, <span style="color: #0000ff;">$_args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">#lo autorizamos por POST</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$frob</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_auth_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#y pedimos el frob de nuevo</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$frob</span> = <a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$frob</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Location'</span><span style="color: #66cc66;">&#93;</span>, <a href="http://www.php.net/strpos"><span style="color: #000066;">strpos</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$frob</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Location'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000;">'frob='</span><span style="color: #66cc66;">&#41;</span>+<a href="http://www.php.net/strlen"><span style="color: #000066;">strlen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'frob='</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#token</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'frob'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$frob</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.auth.getToken'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$token</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$token</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$token</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$token</span> = <span style="color: #0000ff;">$token</span>-&gt;<span style="color: #006600;">auth</span>-&gt;<span style="color: #006600;">token</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#tiket</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'frob'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$frob</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.getUploadTicket'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$tiket</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$tiket</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tiket</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$tiket</span> = <span style="color: #0000ff;">$tiket</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">id</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#upload video</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file</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;">'video'</span>=&gt;<span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'auth_token'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$token</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'ticket_id'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$tiket</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$upload</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_upload_url</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$file</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#check</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'frob'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$frob</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.checkUploadStatus'</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'ticket_id'</span>&nbsp;=&gt; <span style="color: #0000ff;">$tiket</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$check</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$check</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$check</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#title</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.setTitle'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'title'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$title</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'video_id'</span>&nbsp; =&gt; <span style="color: #0000ff;">$check</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">video_id</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$title</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$title</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$title</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#caption</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'caption'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$descripcion</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.setCaption'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'video_id'</span>&nbsp; =&gt; <span style="color: #0000ff;">$check</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">video_id</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$caption</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$caption</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$caption</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#tags</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.addTags'</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'tags'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$tags</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'video_id'</span>&nbsp; =&gt; <span style="color: #0000ff;">$check</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">video_id</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$tags</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$tags</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#privacidad</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$permisos</span> = <a href="http://www.php.net/strtolower"><span style="color: #000066;">strtolower</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$permisos</span>!=<span style="color: #ff0000;">'anybody'</span> &amp;&amp; <span style="color: #0000ff;">$permisos</span>!=<span style="color: #ff0000;">'nobody'</span> &amp;&amp; <span style="color: #0000ff;">$permisos</span>!=<span style="color: #ff0000;">'contacts'</span> &amp;&amp; !<a href="http://www.php.net/strpos"><span style="color: #000066;">strpos</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span>, <span style="color: #ff0000;">','</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>&nbsp; <span style="color: #ff0000;">'ERROR: Los permisos permitidos son &quot;nobody&quot; para que sea privado, &quot;anybody&quot;,'</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' para que sea publico, &quot;contacts&quot; para que solo lo puedan ver los contactos del'</span>.</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' usuario registrado o una lista de usuarios separada por comas para que solo esos'</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' usuarios puedan ver el video. (la funcion requiere que si se usa esta ultima'</span>.</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' opción se ponga al menos una coma final.'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #000066;">strpos</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span>, <span style="color: #ff0000;">','</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.setPrivacy'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'privacy'</span>&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">'users'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'users'</span>&nbsp;&nbsp;=&gt; <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span>, -<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">','</span><span style="color: #66cc66;">&#41;</span> ? <a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span>, <span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0000ff;">$permisos</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'video_id'</span>&nbsp; =&gt; <span style="color: #0000ff;">$check</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">video_id</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$args</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'api_key'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$api_key</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'format'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'php'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'method'</span>&nbsp; &nbsp; =&gt; <span style="color: #ff0000;">'vimeo.videos.setPrivacy'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'privacy'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$permisos</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'video_id'</span>&nbsp; =&gt; <span style="color: #0000ff;">$check</span>-&gt;<span style="color: #006600;">ticket</span>-&gt;<span style="color: #006600;">video_id</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span>=<span style="color: #0000ff;">$api_secret</span>; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$s</span> .= <span style="color: #0000ff;">$k</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&nbsp; <span style="color: #0000ff;">$args</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'api_sig'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/md5"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$permisos</span> = source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$api_rest_url</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$args</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$permisos</span> = <a href="http://www.php.net/unserialize"><span style="color: #000066;">unserialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$permisos</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'login'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$login</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'frob'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$frob</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'token'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$token</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'tiket'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$tiket</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'upload'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$upload</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'check'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$check</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'title'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$title</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'caption'</span>&nbsp; &nbsp;=&gt; <span style="color: #0000ff;">$caption</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'tags'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$tags</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'privacity'</span>&nbsp;=&gt; <span style="color: #0000ff;">$permisos</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Como resultado la función da un conjunto ordenado en array de las respuestas ofrecidas en cada consulta a la API de vimeo para que podamos extraer o interpretar los datos que queramos.</p>
<p>Para que funcione correctamente tenemos que poner las siguientes variables (en orden):</p>
<ul>
<li>Dirección del archivo a subir. La dirección tiene que estar en el servidor. No se permite indicar otras paginas web por motivos de seguridad en <a href="http://es.php.net/curl">cURL</a>.</li>
<li>Email de la cuenta de usuario a la que se quiere subir el archivo.</li>
<li>Contraseña de la cuenta de vimeo a la que se va a subir el archivo</li>
<li>Titulo del video a subir (opcional)</li>
<li>Descripción del video (opcional)</li>
<li>Etiquetas del video, <em>IMPORTANTE: separadas por comas</em> (opcional)</li>
<li>Permiso de acceso al video. Los vídeos se suben como predeterminado con el permiso en <code>nobody</code>, lo que quiere decir que solo los puede ver el usuario que los ha subido. Los permisos que se pueden poner aquí son <code>nobody</code> para que sea un video privado, <code>anybody</code> para que sea público, <code>contacts</code> para que lo puedan ver solo los contactos agregados a la cuenta de vimeo en la que se sube el video o los nombres de los usuarios a los que se desea dar permiso para que puedan ver el video. Si solo se desea dar permiso a un usuario es obligatorio escribir una coma al final. (opcional)</li>
<li>Key del programa. Vimeo identifica las firmas de cada aplicación a partir de las key, así que si quieres usar esta función sin modificar esto no hay problema. La función viene ya con una key pero si quieres modificar la que tiene predeterminada para firmar tu propio programa solo tienes que ponerla aquí. (opcional)</li>
<li>Key secreta. Es el complemento a la key anterior para firmar las peticiones. si cambias el parámetro anterior es obligatorio que cambies este también por los datos de la nueva key. (opcional)</li>
</ul>
<p>Y ahora un ejemplo simple:<br />
Este ejemplo sube un video en mp4 llamado "gato_saltando.mp4" situado en la misma carpeta donde se ejecute al función.</p>
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showPlainTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$video_datos</span> = vimeo_upload<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'gato_saltando.mp4'</span>, <span style="color: #ff0000;">'cuenta_de_usu@rio.com'</span>, <span style="color: #ff0000;">'SeCrEt0'</span>, <span style="color: #ff0000;">'Gato saltando!!'</span>, <span style="color: #ff0000;">'Texto que explica lo que se ve en el video. En este caso supongo que seria un gato saltando un rato....'</span>, <span style="color: #ff0000;">'gato, saltando, cat, jumping'</span>, <span style="color: #ff0000;">'anybody'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #000066;">strpos</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$video_datos</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'upload'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span>,<span style="color: #ff0000;">'stat=&quot;ok&quot;'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El video se ha subido con &amp;eacite;xito'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'No se pudo subir el video: '</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/print_r"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$video_datos</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Recordad que siempre los archivos a enviar tiene que estar previamente dentro del servidor web.<br />
Para subir los vídeos a vuestro servidor web hay <a href="http://blog.unijimpe.net/upload-de-archivos-con-php/">muchísimos</a> <a href="http://www.desarrolloweb.com/articulos/1307.php">script</a> que <a href="http://www.elguruprogramador.com.ar/articulos/upload-de-archivos-usando-php.htm">podéis usar</a>.</p>
<p>Si alguien quiere hacer algo parecido o modificar esta función se puede sentir libre de hacerlo, y si lo deja por aquí mejor que mejor..! Solo comentar que si queréis seguir usando otras propiedades de la API de vimeo tened en cuenta que aun no se por que pero en mi experiencia el "orden" de lo introducido en la consulta es vital para evitar que aparezcan los errores Invalid "111 Signature" sin razón aparente.<br />
Para cualquier cosa comentario.. y como mención especial no puedo dejar de agradecer al señor <a href="http://www.sinctrl.com/edeleon/">@edeleon</a> la rápida y acertada respuesta en mis dudas, Gracias.<br />
<ins datetime="2009-06-02T15:25:11+00:00">Gracias de nuevo al Sr. <a href="http://www.sinctrl.com/edeleon/">@edeleon</a> he encontrado un bug que afecta a la primera vez que se intenta subir un video a una cuenta nueva... el sistema intentaba asociar la API-KEY a la cuenta y al no conseguirlo, no podia subir el video correctamente. Por esto se le ha añadido una comprobación en el apartado <code>#frob</code>.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/04/01/vimeo_upload-sube-videos-a-vimeo-desde-tu-servidor-con-php/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Source_extract() version2, envío y extracción de datos desde PHP como si fuera un navegador</title>
		<link>http://www.tierra0.com/2009/03/27/source_extract-version2-envio-y-extraccion-de-datos-desde-php-como-si-fuera-un-navegador/</link>
		<comments>http://www.tierra0.com/2009/03/27/source_extract-version2-envio-y-extraccion-de-datos-desde-php-como-si-fuera-un-navegador/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 19:55:43 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Imagenes]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Online]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=240</guid>
		<description><![CDATA[Los retos se amplían y source_extract() necesitaba un nuevo enfoque para madurar y ser mas versátil, de manera que, frente a la anterior version que solo enviaba POST y usaba Cookies suplantando un navegador, esta nueva version mejora el soporte, permitiendo enviar datos por GET y POST, pudiendo enviar no solo textos si no a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3196/3056700987_91d303e018_o.png" alt="source extract" style="float:left;" />Los retos se amplían y <code><a href="http://www.tierra0.com/2008/11/25/source_extract-extrae-el-codigo-fuente-aun-que-tengan-verificacion-por-cookie/">source_extract()</a></code> necesitaba un nuevo enfoque para madurar y ser mas versátil, de manera que, frente a la anterior version que solo enviaba <code>POST</code> y usaba <code>Cookies</code> suplantando un navegador, esta nueva version mejora el soporte, permitiendo enviar datos por <code>GET</code> y <code>POST</code>, pudiendo enviar no solo textos si no a demás poder hacer upload de archivos, con opción de mostrar la <code>cabecera HTTP</code> y todo sin perder la opcion de usar <code>cookies</code>. El único problema es que la reestructuración de variables ha echo que no sean igual que en la anterior versión ya que se ha re-escrito casi entera.</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> source_extract<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$POSTdata</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$GETdata</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_upload</span>=<span style="color: #ff0000;">''</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$header</span>=<span style="color: #000000; font-weight: bold;">false</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cookie</span>=<span style="color: #000000; font-weight: bold;">false</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$user_agent</span> = <span style="color: #ff0000;">'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#get</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GETdata</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GETdata</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span> =&gt; <span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; <span style="color: #0000ff;">$GETdata</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$k</span>.<span style="color: #ff0000;">'='</span>.<a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span>;&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$GETdata</span> = <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&amp;'</span>, <span style="color: #0000ff;">$GETdata</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GETdata</span>!=<span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0000ff;">$url</span> .= <a href="http://www.php.net/strpos"><span style="color: #000066;">strpos</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span>, <span style="color: #ff0000;">'?'</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #ff0000;">'&amp;'</span>.<span style="color: #0000ff;">$GETdata</span> : <span style="color: #ff0000;">'?'</span>.<span style="color: #0000ff;">$GETdata</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#post+files</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$POSTdata</span><span style="color: #66cc66;">&#41;</span>&amp;&amp;!<a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$POSTdata</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span> =&gt; <span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp;<span style="color: #0000ff;">$POSTdata</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$k</span>.<span style="color: #ff0000;">'='</span>.<span style="color: #0000ff;">$v</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$POSTdata</span> = <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&amp;'</span>, <span style="color: #0000ff;">$POSTdata</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/count"><span style="color: #000066;">count</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$POSTdata</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$POSTdata</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file_upload</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$v</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span>,<span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>!=<span style="color: #ff0000;">'.'</span>&amp;&amp;substr<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span>,<span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>!=<span style="color: #ff0000;">'/'</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #ff0000;">'./'</span>.<span style="color: #0000ff;">$v</span> : <span style="color: #ff0000;">''</span>.<span style="color: #0000ff;">$v</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$path_v</span>&nbsp;&nbsp;&nbsp;&nbsp;= <a href="http://www.php.net/realpath"><span style="color: #000066;">realpath</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/dirname"><span style="color: #000066;">dirname</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_v</span>&nbsp;&nbsp;&nbsp;&nbsp;= <a href="http://www.php.net/basename"><span style="color: #000066;">basename</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #ff0000;">'@'</span>.<span style="color: #0000ff;">$path_v</span>.<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$path_v</span>,-<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>!=<span style="color: #ff0000;">'/'</span> ? <span style="color: #ff0000;">'/'</span> : <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0000ff;">$file_v</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_upload</span> = <a href="http://www.php.net/array_merge"><span style="color: #000066;">array_merge</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$POSTdata</span>, <span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$ch</span> = curl_init<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#41;</span>|| <span style="color: #0000ff;">$POSTdata</span>!=<span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_POST, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_POSTFIELDS, <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file_upload</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$file_upload</span> : <span style="color: #0000ff;">$POSTdata</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_COOKIEJAR, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_COOKIEFILE, <span style="color: #0000ff;">$cookie</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$header</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_HEADER, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_RETURNTRANSFER, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_SSL_VERIFYPEER, <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span>,<span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">'https'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span>, CURLOPT_USERAGENT, <span style="color: #0000ff;">$user_agent</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$_url_content</span> = <span style="color: #0000ff;">$url_content</span> = curl_exec <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ch</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url_content</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'url'</span>&nbsp; &nbsp;&nbsp; &nbsp;=&gt;<span style="color: #0000ff;">$url</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'post'</span>&nbsp; &nbsp; =&gt;<span style="color: #0000ff;">$file_upload</span> ? <span style="color: #0000ff;">$file_upload</span> : <span style="color: #0000ff;">$POSTdata</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'content'</span>&nbsp; &nbsp;=&gt;<span style="color: #0000ff;">$_url_content</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$header</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$_url_content</span> = <a href="http://www.php.net/explode"><span style="color: #000066;">explode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>, <span style="color: #0000ff;">$_url_content</span>,<span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/count"><span style="color: #000066;">count</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#41;</span>&gt;<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>.<span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <a href="http://www.php.net/explode"><span style="color: #000066;">explode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>, <span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$k</span>=&gt;<span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; <span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/explode"><span style="color: #000066;">explode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">': '</span>, <span style="color: #0000ff;">$v</span>,<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'header'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$o</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span>&nbsp;= <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/count"><span style="color: #000066;">count</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#41;</span>&gt;<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #0000ff;">$_url_content</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$url_content</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El primer parámetro es la URL de referencia donde queremos hacer la consulta o extraer el texto.<br />
El segundo, y tercero son arrays que respectivamente introducen los datos a enviar por <code>POST</code> y <code>GET</code>. En ambos casos se pueden introducir tanto texto en formato <code>campo=valor&#038;campo2=valor</code> o siendo un <code>array</code> en el que las key son los nombres de los campos a enviar y los valores los textos a enviar. Si se pretende enviar algún archivo en la petición es obligatorio que los valores que se envíen por <code>POST</code> estén en formato <code>array</code>.<br />
El cuarto parámetro es un array de archivo/s a subir por <code>POST</code> a la <code>URL</code> de destino. El array debe tener como key los nombres de campo y como valor las direcciones donde se encuentran los archivos. Los archivos tienen que estar dentro del servidor, si se redireccióna alguno externo no se enviará correctamente.<br />
El quinto parametro es un valor boleano de true o false, que tiene false por defecto. Si se pone a true mostrara un valor en el array de salida llamado <code>header</code> que contiene una array de las distintas propiedades devueltas en la consulta HTTP.<br />
El sexto y ultimo parámetro indica la utilización de cookies. Por defecto esta en false para no ser utilizado pero si se le indica la ruta de un archivo, este actúa como un cache de cookies entre consultas almacenando valores entre estas.</p>
<p>Esta vez pondré en otro articulo un ejemplo mas real, por ahora aquí os va un ejemplo para probar todas las propiedades..</p>
<p>Creamos en la misma carpeta un archivo que se llame <code>cookie.txt</code>, y subimos en el mismo sitio una imagen JPG a la que cambiaremos el nombre por "imagen.jpg". Esta imagen va a ser la que vamos a "transmitir".<br />
A continuacion creamos otro que se llame <code>receptor.php</code>, y en este escribimos lo siguiente.</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//archivo creado para comprobar si se obtienen bien los datos de get, post y files</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'////////// INICIO DEL CONTENIDO DE LA PAGINA /////////////////'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$data</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'_GET'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$_GET</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'_POST'</span>&nbsp;&nbsp;=&gt; <span style="color: #0000ff;">$_POST</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'_FILES'</span>&nbsp; &nbsp; =&gt; <span style="color: #0000ff;">$_FILES</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'////////// FIN DEL CONTENIDO DE LA PAGINA ////////////////////'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Este archivo nos servirá como receptor de la prueba con la que vamos a poder comprobar que datos llegan..</p>
<p>Por ultimo hacemos el código de la pagina propia, con el que vamos a hacer la consulta.<br />
Ponemos el nombre que queramos a la pagina y insertamos el código a continuación.</p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$url</span> = <span style="color: #ff0000;">'receptor.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$post</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;">'ejemplo_post'</span>=&gt;<span style="color: #ff0000;">'Ejemplo de datos enviados por post'</span>, <span style="color: #ff0000;">'otro_ejemplo'</span>=&gt;<span style="color: #cc66cc;color:#800000;">32486245378934</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$get</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;">'ejemplo_get'</span>=&gt;<span style="color: #ff0000;">'Ejemplo de datos enviados por get'</span>, <span style="color: #ff0000;">'otro_ejemplo_por_get'</span>=&gt;<span style="color: #cc66cc;color:#800000;">37827489237</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$file_upload</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;">'Nombre_de_archivo'</span>=&gt; <span style="color: #ff0000;">'./imagen.jpg'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span>source_extract<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span>, <span style="color: #0000ff;">$post</span>, <span style="color: #0000ff;">$get</span>, <span style="color: #0000ff;">$file_upload</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #ff0000;">'./cookie.txt'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*Esta parte debeis sustituirla por el codigo de la funcion que aparece en la parte de arriba*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hay que tener muy en cuenta que hay q sustituir el ultimo comentario por la función de arriba del todo para que el ultimo archivo se ejecute correctamente.</p>
<p>Cuanto tengamos todo y abramos el ultimo archivo desde el navegador veremos que nos aparecen varios datos entre los que se encontrara la cabecera, un array con todos los datos contenidos de la pagina <code>receptor.php</code> y los datos enviados por post, url...</p>
<p>Pronto tendremos un ejemplo más tangible..<br />
<ins datetime="2009-04-15T10:24:01+00:00">A peticion del publico he realizado una corrección en la linea 78 del código de la función que activa automáticamente el soporte de <code>SSL</code> para las paginas web <code>HTTPS</code>. Si alguien tiene algún problema o incompatibilidad con esa corrección q me lo comente</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/03/27/source_extract-version2-envio-y-extraccion-de-datos-desde-php-como-si-fuera-un-navegador/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Apuntes sobre APIs</title>
		<link>http://www.tierra0.com/2009/03/23/apuntes-sobre-apis/</link>
		<comments>http://www.tierra0.com/2009/03/23/apuntes-sobre-apis/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 12:25:42 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Online]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=232</guid>
		<description><![CDATA[Una gran necesidad y oportunidad para una herramienta onlie es poder compartir sus potencia de una forma fácil con el resto de la comunidad de desarrolladores para que entre estos puedan usar los datos y capacidades de la aplicación para crear nuevos servicios. Por esto en la web 2.0 es algo totalmente necesario crear una [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3429/3379146668_ef5d7bd299_o.png" alt="Api" style="float:right;" />Una gran necesidad y oportunidad para una herramienta onlie es poder compartir sus potencia de una forma fácil con el resto de la comunidad de <a href="http://es.wikipedia.org/wiki/Desarrollador_de_software">desarrolladores</a> para que entre estos puedan usar los datos y capacidades de la aplicación para crear nuevos servicios. Por esto en la web 2.0 es algo totalmente necesario crear una API no solo para que otros servicios puedan acceder al nuestro si no para que inclusive nosotros podamos desarrollar y cambiar la parte gráfica de la aplicación independientemente del código que ofrece el servicio, ofreciendo las mejores prestaciones a los desarrolladores internos y externos. Por esto existen API abiertas que cualquiera puede utilizar y cerradas, que son propias y especificas dentro del servicio.</p>
<p>Ultimamente he visto q toda la web tiene de estas API y que cada una funciona casi de una forma, pero quería reunirme por escrito las igualdades que he ido viendo por si me puede servir en algún proyecto o para crear una propia en algun proyecto..</p>
<p>Al parecer entre varios estándar las web 2.0 prefieren con diferencia usar <a href="http://es.wikipedia.org/wiki/Representational_State_Transfer">REST</a>, la cual esta basada en la utilización de los métodos GET, POST, PUT y DELETE para el envío y recepción de información entre el usuario y el servidor, aun que este estándar no se cumple en la mayoría. El estándar primitivo indica que para subir algún archivo se debería usar PUT, y para borrarlos DELETE entre otras funciones reestablecidas, devolviendo siempre los datos en XML. Pero normalmente se usa un sistema con el que están más familiarizados el resto de desarrolladores.<br />
Lo que se suele usar es un sistema mixto que recibe los datos por REST usando <a href="http://www.tierra0.com/2008/01/05/funciones-para-soporte-de-urls-amigables-friendlyurl/">FriendlyUrl</a> y GET, y utilizando POST para las modificaciones o para subir archivos.</p>
<p>Esto se suele realizar así por que es muy fácil utilizar un proxy o un programa en el servidor que realce una cache parcial de los datos si estos se pasan dentro de la URL de consulta, y es mas complejo si van acompañados de los datos en la misma cabecera...</p>
<p>En cuanto a las resupuestas de las aplicaciones lo que mas abunda son en XML. es un sistema facil y limpio que es facil de leer por todos los lenguajes en los que se quiera hacer el <a href="http://es.wikipedia.org/wiki/Mashup_(aplicación_web_híbrida)">mashup</a>. Pero el tiempo ha llevado a los creadores de API a poner alternativas con mejor rendimiento para los lenguajes estrella en la web, y casi todas se pueden traducir a <a href="http://es.wikipedia.org/wiki/JSON">jSon</a>, un sistema para mostrar la información mucho mas liviano en aplicaciones JavaScript o PHP. Aunque para la utilización de los datos en PHP, debido a que solo desde la versión 5.0 esta soportado natívamente jSon, algunas API permiten obtener los datos convertidos por <code><a href="http://es.php.net/serialize">serialize()</a></code> directamente para recogerlos con <code><a href="http://es.php.net/unserialize">unserialize()</a></code> de una forma rápida y liviana.</p>
<p>Como norma general no se suele utilizar la identificación del usuario o el almacenamiento de datos en cookies debido a que seria un obstáculo en algunos lenguajes como también lo seria para el almacenamiento en cache.</p>
<p>Algunos lenguajes de ejemplo:<br />
APIs de las aplicaciones de google | <a href="http://code.google.com/intl/es-ES/more/">code.google.com</a><br />
APIs de las aplicaciones de Yahoo | <a href="http://developer.yahoo.com/everything.html">developer.yahoo.com</a><br />
API de vimeo | <a href="http://www.vimeo.com/api">www.vimeo.com/api</a></p>
<p>Como ultimo apunte os dejo un enlace sobre <a href="http://www.sematopia.com/?p=153">como crear un motor de respuestas REST</a> desde <a href="http://www.sematopia.com/">sematopia.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/03/23/apuntes-sobre-apis/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>pag(), paginación de resultados, objetos o paginas en PHP</title>
		<link>http://www.tierra0.com/2009/02/21/pag-paginacion-de-resultados-objetos-o-paginas-en-php/</link>
		<comments>http://www.tierra0.com/2009/02/21/pag-paginacion-de-resultados-objetos-o-paginas-en-php/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 13:10:12 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Online]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=215</guid>
		<description><![CDATA[Algo que suele ser repetitivo en la mayoría de proyectos sobre todo si se usan bases de datos o listados de objetos, archivos, arrays... (cosa que en casi todos por no decir en todos se usa) es la paginación. La paginación como todos supongo que sabréis vale para dividir un conjunto de datos muy grande [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3427/3296671649_8b5c410637_o.png" alt="Función pag()" style="float:right; margin:3px;" />Algo que suele ser repetitivo en la mayoría de proyectos sobre todo si se usan bases de datos o listados de objetos, archivos, arrays... (cosa que en casi todos por no decir en todos se usa) es la paginación. La paginación como todos supongo que sabréis vale para dividir un conjunto de datos muy grande en porciones y poder navegar de esta forma entre los resultados. (si queréis ver un ejemplo solo tenéis que ir a la parte de abajo de <a href="http://www.google.es/search?hl=es&#038;q=tierra0#nav">google después de hacer una búsqueda</a>).</p>
<p>Después de investigar como hacían otros este proceso me di cuenta que las soluciones mas comunes estaba solo orientadas dentro del <a href="http://jpinedo.webcindario.com/scripts/paginator/PHP">PHP</a> a <a href="http://www.web-studio.com.ar/proyectos/paginado/paginado_documentacion.htm">mysql</a>, y integraban no solo el manejo del menú de la pagina si no que a demás <a href="http://www.baluart.net/articulo/paginacion-perfecta-con-php">cortaban los objetos a mostrar o no mostrar</a>.. cosa que no me interesaba. Yo solo quería el menú, y queria que pudiera valerme no solo para una base de datos, si no para un array o lo q fuera necesario.. :S.</p>
<p>La función que propongo hoy para solucionar esto es <code>pag()</code> la cual lo que hace es a partir de unos datos básicos introducidos como la pagina en la que se quiere estar, el numero de elementos a representar en el menú y el numero de elementos a visualizar por pagina devuelve un array con el contenido personalizado en numero de cada objeto, rango de objetos.. dando opciones a personalizar esta salida o mostrarlo con un simple enlace..</p>
<p>Para meternos en materia os pongo para que vale cada variable de la función por su orden:</p>
<ol>
<li>Pagina en la que se quiere estar o nombre de la variable GET o POST que va a contener el numero de pagina</li>
<li>Total de objetos que hay en la lista a representar (total de resultados de una consulta, o de un array, o de archivos en una carpeta que queramos representar paginada)</li>
<li>Numero de objetos que queremos que aparezcan en cada pagina</li>
<li>Numero que indica cuantas paginas se ven en el menú generado</li>
<li>Código HTML o texto que acompañará a cada numero.. si está vacio será representado por un enlace simple pero se puede completar con un texto HTML cualquiera. En este texto podemos insertar <code>[p]</code> en cada parte que deseemos que aparezca el numero de pagina. Si se inserta un array con dos textos, el primero corresponderá a los números de pagina normales y el segundo cuando la pagina sea la pagina que se está visitando.</li>
<li>Si se desea incluir el botón "atrás" o "anterior" a partir de esta variable se puede escribir <code>true</code> para que aparezca un botón estándar, <code>false</code> para que no aparezca ningún botón o un texto HTML como en la anterior variable, en el que también se sustituirá <code>[p]</code> por el numero de pagina "anterior". Si el menú esta situado en la primera pagina no se mostrara este botón.</li>
<li>Idéntico funcionamiento al anterior. Esta variable establece si queremos mostrar el botón de "pagina siguiente". Como en el anterior <code>false</code> o <code>true</code> lo activan o desactivan y un texto personalizado puede ser establecido como base, siendo sustituido <code>[p]</code>. (este botón no será mostrado si el menú está en el ultimo resultado.)</li>
<li>Esta ultima variable de la función establece si se quiere mostrar un botón que lleva a la ultima pagina. Como en los anteriores, si se quiere activar el modo por defecto que incluye un enlace, solo hay que poner <code>true</code>, si se prefiere que no salga, <code>false</code> y si se quiere personalizar solo hay que poner el texto o código HTML con <code>[p]</code> en las zonas donde se quiere que se escriban el numero correspondiente.</li>
</ol>
<p>Aquí va el código de la función:</p>
<div class="igBar"><span id="lphp-26"><a href="#" onclick="javascript:showPlainTxt('php-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-26">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> pag<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$pag_actual</span>&nbsp;&nbsp;&nbsp;&nbsp;= <span style="color: #cc66cc;color:#800000;">1</span>, &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$total_objetos</span>&nbsp; &nbsp; &nbsp; = <span style="color: #cc66cc;color:#800000;">60</span>,&nbsp;<span style="color: #808080; font-style: italic;">//total de objetos a contar</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$objetos_por_pagina</span>&nbsp;&nbsp;= <span style="color: #cc66cc;color:#800000;">5</span>,&nbsp;<span style="color: #808080; font-style: italic;">//total de objetos por cada pagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$objetos_por_menu</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #cc66cc;color:#800000;">5</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//números que aparecerán en el menú</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$texto_html</span>&nbsp;&nbsp;&nbsp;= <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$anterior</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #000000; font-weight: bold;">true</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//poner botón par anterior o texto</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$siguiente</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #000000; font-weight: bold;">true</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner botón para siguiente o texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$final</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #000000; font-weight: bold;">false</span>&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner la ultima pagina</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#argumentos adicionales para cálculos</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$texto_html</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= <span style="color: #0000ff;">$texto_html</span>==<span style="color: #ff0000;">''</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;">'&lt;a href=&quot;#[p]&quot;&gt;[p]&lt;/a&gt;'</span>, <span style="color: #ff0000;">'&lt;a&gt;[p]&lt;/a&gt;'</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0000ff;">$texto_html</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$total_paginas</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/ceil"><span style="color: #000066;">ceil</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$total_objetos</span>/<span style="color: #0000ff;">$objetos_por_pagina</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//total de paginas</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$mitad_de_objetos_por_menu</span>&nbsp; &nbsp; = <a href="http://www.php.net/round"><span style="color: #000066;">round</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$objetos_por_menu</span>/<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//mitad del menú</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$mitad_de_objetos_por_menu_baj</span>&nbsp; = <a href="http://www.php.net/floor"><span style="color: #000066;">floor</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$objetos_por_menu</span>/<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//mitad del menú a la baja</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#corrección de errores en pagina introducida</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<a href="http://www.php.net/is_numeric"><span style="color: #000066;">is_numeric</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #0000ff;">$pag_actual</span> = <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$pag_actual</span><span style="color: #66cc66;">&#93;</span> ? <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$pag_actual</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$pag_actual</span><span style="color: #66cc66;">&#93;</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>&lt;=<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">$pag_actual</span> = <span style="color: #cc66cc;color:#800000;">1</span>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #66cc66;">&#125;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>&gt;<span style="color: #0000ff;">$total_paginas</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp;<span style="color: #0000ff;">$pag_actual</span> = <span style="color: #0000ff;">$total_paginas</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>&lt;=<span style="color: #0000ff;">$mitad_de_objetos_por_menu</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//detectamos si esta al principio&nbsp; &nbsp;&nbsp; &nbsp;[desde el 1 hasta el $mitad_de_objetos_por_menu]</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$debug_zone</span> = <span style="color: #ff0000;">'inicio'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$ini</span> = <span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fin</span> = <span style="color: #0000ff;">$objetos_por_menu</span>&lt;<span style="color: #0000ff;">$total_paginas</span> ? <span style="color: #0000ff;">$objetos_por_menu</span> : <span style="color: #0000ff;">$total_paginas</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>&lt;=<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$total_paginas</span>-<span style="color: #0000ff;">$mitad_de_objetos_por_menu</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//detectamos si esta en la zona central&nbsp;[desde el $mitad_de_objetos_por_menu hasta el ($total_paginas-$mitad_de_objetos_por_menu)]</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$debug_zone</span> = <span style="color: #ff0000;">'medio'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$ini</span> = <span style="color: #0000ff;">$mitad_de_objetos_por_menu_baj</span>&gt;<span style="color: #0000ff;">$pag_actual</span> ? </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$mitad_de_objetos_por_menu_baj</span>-<span style="color: #0000ff;">$pag_actual</span> : <span style="color: #0000ff;">$pag_actual</span>-<span style="color: #0000ff;">$mitad_de_objetos_por_menu_baj</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fin</span> = <span style="color: #0000ff;">$mitad_de_objetos_por_menu_baj</span>+<span style="color: #0000ff;">$pag_actual</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//detectamos si esta al final&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;[desde ($total_paginas-$mitad_de_objetos_por_menu) hasta $total_paginas]</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$debug_zone</span> = <span style="color: #ff0000;">'fin'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$ini</span> = <span style="color: #0000ff;">$total_paginas</span>-<span style="color: #0000ff;">$objetos_por_menu</span>+<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fin</span> = <span style="color: #0000ff;">$total_paginas</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$final</span> = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//generamos el array de números necesarios para el menú</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$i</span>=<span style="color: #0000ff;">$ini</span>;<span style="color: #0000ff;">$i</span>&lt;=<span style="color: #0000ff;">$fin</span>;<span style="color: #0000ff;">$i</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pags'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$i</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #0000ff;">$i</span>.<span style="color: #ff0000;">'&quot;&gt;'</span>.<span style="color: #0000ff;">$i</span>.<span style="color: #ff0000;">'&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$texto_html</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[p]'</span>, <span style="color: #0000ff;">$i</span>, <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>==<span style="color: #0000ff;">$i</span> ? <span style="color: #0000ff;">$texto_html</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #0000ff;">$texto_html</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[p]'</span>, <span style="color: #0000ff;">$i</span>, <span style="color: #0000ff;">$texto_html</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#determinamos si se puede poner anterior</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>!=<span style="color: #cc66cc;color:#800000;">1</span> &amp;&amp; <span style="color: #0000ff;">$anterior</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$anterior</span>===<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;<span style="color: #0000ff;">$anterior</span> = <span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span>;&nbsp;&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'anterior'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pags'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array_merge"><span style="color: #000066;">array_merge</span></a><span style="color: #66cc66;">&#40;</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;">'anterior'</span> =&gt; <span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pags'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array_merge"><span style="color: #000066;">array_merge</span></a><span style="color: #66cc66;">&#40;</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;">'anterior'</span> =&gt; <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot;&gt;anterior&lt;/a&gt;'</span>&nbsp; <span style="color: #66cc66;">&#41;</span>,&nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$siguiente</span>!==<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array_merge"><span style="color: #000066;">array_merge</span></a><span style="color: #66cc66;">&#40;</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;">'anterior'</span> =&gt; <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[p]'</span>, <span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #0000ff;">$anterior</span><span style="color: #66cc66;">&#41;</span>&nbsp;<span style="color: #66cc66;">&#41;</span>,&nbsp; &nbsp;<span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$siguiente</span>!==<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array_merge"><span style="color: #000066;">array_merge</span></a><span style="color: #66cc66;">&#40;</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;">'anterior'</span> =&gt; <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>-<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot;&gt;anterior&lt;/a&gt;'</span>&nbsp; <span style="color: #66cc66;">&#41;</span>,&nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$anterior</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#determinamos si se debe poner el max final</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'final'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$total_paginas</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pags'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'final'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$total_paginas</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'final'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #0000ff;">$total_paginas</span>.<span style="color: #ff0000;">'&quot;&gt;...'</span>.<span style="color: #0000ff;">$total_paginas</span>.<span style="color: #ff0000;">'&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span>!==<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'final'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;= <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[p]'</span>, <span style="color: #0000ff;">$total_paginas</span>, <span style="color: #0000ff;">$final</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span>===<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'final'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #0000ff;">$total_paginas</span>.<span style="color: #ff0000;">'&quot;&gt;...'</span>.<span style="color: #0000ff;">$total_paginas</span>.<span style="color: #ff0000;">'&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#determinamos si se puede poner siguiente</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>!=<span style="color: #0000ff;">$total_paginas</span> &amp;&amp; <span style="color: #0000ff;">$siguiente</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'siguiente'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$pag_actual</span>+<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pags'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'siguiente'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$pag_actual</span>+<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'siguiente'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>+<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot;&gt;siguiente&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$siguiente</span>!==<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'siguiente'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;= <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[p]'</span>, <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>+<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$siguiente</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$siguiente</span>===<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'html'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'siguiente'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;= <span style="color: #ff0000;">'&lt;a href=&quot;?p='</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>+<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot;&gt;siguiente&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$siguiente</span><span style="color: #66cc66;">&#41;</span>;&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'ini'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>*<span style="color: #0000ff;">$objetos_por_pagina</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #0000ff;">$objetos_por_pagina</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//primer objeto de la página</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fin'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pag_actual</span>*<span style="color: #0000ff;">$objetos_por_pagina</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #cc66cc;color:#800000;">1</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//ultimo objeto de la página</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$out</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La función comienza con el supuesto de que la 1º pagina es la pagina 1 (y no la cero) y el primer objeto es el 0 (no el uno) para seguir una correlación lógica entre la parte del código/consulta y la parte de la interfaz del usuario.<br />
Si se encuentra con que la pagina es 0, o menor a 0 la sustituirá por 1 y si se encuentra que la pagina es mayor del numero total de paginas calculadas la sustituirá por la ultima pagina.</p>
<p>Como salida esta función da un array multidimensional que muestra las key <code>ini</code> que corresponde al número del primer objeto de la página, <code>fin</code> que corresponde al número del ultimo objeto de la pagina, y <code>menu</code> que contendrá a su vez en forma de array las tres formas de representación del menú <code>pags</code> (contiene un array con todos los números de pagina resultantes),  <code>link</code> (que muestra un menú estándar echo de enlaces) y <code>html</code> (que muestra el menú personalizado a partir de los textos html).<br />
Como opcional en cada punto y según las opciones seleccionadas, pueden aparecer adicionalmente en el array las key <code>anterior</code>, <code>siguiente</code> y <code>final</code>, que contendrían los botones específicos para ir a esas paginas.</p>
<p>Y ahora q sabemos como controlarlo todo y que sale en consecuencia vamos a hacer alguna prueba..</p>
<p>El primer ejemplo es el modo más simple y estático de usar la función. Usaremos los valores por defecto desactivando todos los botones adicionales para que solo aparezca el menú con enlaces estándar.</p>
<div class="igBar"><span id="lphp-27"><a href="#" onclick="javascript:showPlainTxt('php-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-27">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$menu</span> = pag<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">1</span>, &nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">600</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//total de objetos a contar</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">6</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//total de objetos a mostrar por cada pagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">10</span>,&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//numeros que apareceran en el menu</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">''</span>,&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//texto personalizado a obtener</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>,&nbsp; <span style="color: #808080; font-style: italic;">//poner boton par anterior o texto</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>,&nbsp; <span style="color: #808080; font-style: italic;">//poner boton para siguiente o texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner la ultimapagina</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' '</span>, <span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">"&lt;br/&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El primer objeto seria el objeto numero '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'ini'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">', y el ultimo el '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fin'</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El siguiente ejemplo muestra como hacer un menu que usa <code>p</code> como variable GET que determina en que pagina estamos, complementando el código automático. A demás incluye los botones siguiente y anterior. ha sido personalizado para que tenga 50 objetos y muestre 5 en cada pagina, teniendo un menu de 3 numeros</p>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showPlainTxt('php-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$menu</span> = pag<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'p'</span>, &nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">50</span>,&nbsp;<span style="color: #808080; font-style: italic;">//total de objetos a contar</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">5</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//total de objetos a mostrar por cada pagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">3</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//numeros que apareceran en el menu</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">''</span>,&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//texto personalizado a obtener</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">true</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner boton par anterior o texto</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">true</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner boton para siguiente o texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner la ultimapagina</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' | '</span>, <span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">"&lt;br/&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El primer objeto seria el objeto numero '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'ini'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">', y el ultimo el '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fin'</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El siguiente ejemplo tiene los botones persolanizado para que use la variable GET <code>pagina</code> para determinar en que pagina estamos a la vez que incluye el código HTML de cada botón.</p>
<div class="igBar"><span id="lphp-29"><a href="#" onclick="javascript:showPlainTxt('php-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-29">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$menu</span> = pag<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'pagina'</span>, &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">60</span>,&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//total de objetos a contar</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">5</span>,&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//total de objetos a mostrar por cada pagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">4</span>,&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//numeros que apareceran en el menu</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?pagina=[p]&quot;&gt;[p]&lt;/a&gt;'</span>,&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//texto personalizado a obtener</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?pagina=[p]&quot; title=&quot;anterior&quot;&gt;&amp;larr;&lt;/a&gt;'</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner boton par anterior o texto</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?pagina=[p]&quot; title=&quot;siguiente&quot;&gt;&amp;rarr;&lt;/a&gt;'</span>,&nbsp; <span style="color: #808080; font-style: italic;">//poner boton para siguiente o texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner la ultimapagina</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' | '</span>, <span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">"&lt;br/&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El primer objeto seria el objeto numero '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'ini'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">', y el ultimo el '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fin'</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Como ultimo ejemplo vamos a hacer que muestra la misma estructura del anterior pero a demás, discrimina la pagina actual en el menu, y no le pone enlace para que se pueda diferenciar..</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showPlainTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$menu</span> = pag<span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'pagina'</span>, &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">60</span>,&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">//total de objetos a contar</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">5</span>,&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//total de objetos a mostrar por cada pagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cc66cc;color:#800000;">4</span>,&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//numeros que apareceran en el menu</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//texto personalizado indicando cuando es la pagina actual</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?p=[p]&quot;&gt;[p]&lt;/a&gt;'</span>, </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; id=&quot;actual&quot;&gt;[p]&lt;/a&gt;'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?pagina=[p]&quot; title=&quot;anterior&quot; class=&quot;pag_normal&quot;&gt;&amp;larr;&lt;/a&gt;'</span>,&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//poner boton par anterior o texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000;">'&lt;a class=&quot;menu&quot; href=&quot;?pagina=[p]&quot; title=&quot;siguiente&quot; class=&quot;pag_actual&quot;&gt;&amp;rarr;&lt;/a&gt;'</span>,&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner boton para siguiente o texto</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">false</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//poner la ultimapagina</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' | '</span>, <span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'menu'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'link'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">"&lt;br/&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'El primer objeto seria el objeto numero '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'ini'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">', y el ultimo el '</span>.<span style="color: #0000ff;">$menu</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fin'</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Que lo disfrutéis..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/02/21/pag-paginacion-de-resultados-objetos-o-paginas-en-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Función de extracción de datos Youtube() en PHP version3</title>
		<link>http://www.tierra0.com/2009/02/13/funcion-de-extraccion-de-datos-youtube-en-php-version3/</link>
		<comments>http://www.tierra0.com/2009/02/13/funcion-de-extraccion-de-datos-youtube-en-php-version3/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 11:10:23 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
				<category><![CDATA[Imagenes]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Online]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/?p=208</guid>
		<description><![CDATA[A estas alturas supongo que los que lean este blog seguramente sepan que hace esta función. Es una función que a partir de una ID de youtube extrae el resto de datos del mismo video... El motivo de esta actualización es el aviso de @pablo que me indicaba que en la versión 1 se la [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img82.imageshack.us/img82/681/youtubephpdg8.jpg" alt="Youtube()" style="float:right;" />A estas alturas supongo que los que lean este blog seguramente sepan que hace esta función. Es una función que a partir de una ID de youtube extrae el resto de datos del mismo video...<br />
El motivo de esta actualización es el aviso de <a href="http://www.tierra0.com/2008/01/24/funcion-de-extraccion-de-datos-youtube-en-php-version2/comment-page-1/#comment-673">@pablo</a> que me indicaba que en la versión 1 se la función si que se obtener el usuario que ha subido el video, asi que esa ha sido la primera corrección.<br />
Revisando el código a demás me di cuenta que la fecha también fallaba, así como el debug de fecha, y como guinda.. mucha gente esta usando la direccion de youtube completa para obtener el ID y para los usuarios menos expertos es un coñazo el extraerlo.. así que he incorporado <a href="http://boozox.net/codigo/html-del-visor-de-youtube-a-partir-de-su-url/">el metodo que el genio Alex Barros diseño en Boozox</a> y <a href="http://boozox.net/codigo/html-del-visor-de-youtube-a-partir-de-su-url/#comment-2031">uno de sus lectores @Javier</a> compartieron para que ahora podamos ver los vídeos no solo con la ID si no que también con la URL.</p>
<div class="igBar"><span id="lphp-34"><a href="#" onclick="javascript:showPlainTxt('php-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-34">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> youtube<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</span>, <span style="color: #0000ff;">$debug</span> = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$_id</span> = <a href="http://www.php.net/parse_url"><span style="color: #000066;">parse_url</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/parse_str"><span style="color: #000066;">parse_str</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_id</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'query'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_id</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$id</span> = <a href="http://www.php.net/empty"><span style="color: #000066;">empty</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$id</span> : <span style="color: #0000ff;">$v</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = <span style="color: #ff0000;">'http://es.youtube.com/watch?v='</span>.<span style="color: #0000ff;">$id</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$query</span> = @<a href="http://www.php.net/file_get_contents"><span style="color: #000066;">file_get_contents</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">'!&amp;t=(.+)&amp;!U'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$t</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>title<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;!U"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$titulo</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>description<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;!U"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$descripcion</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!&lt;span class=<span style="color: #000099; font-weight: bold;">\"</span>watch-video-added post-date<span style="color: #000099; font-weight: bold;">\"</span>&gt;(.+) de (.+) de (.+)&lt;/span&gt;!U"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"&lt;meta name=<span style="color: #000099; font-weight: bold;">\"</span>keywords<span style="color: #000099; font-weight: bold;">\"</span> content=<span style="color: #000099; font-weight: bold;">\"</span>(.+)<span style="color: #000099; font-weight: bold;">\"</span>&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$exp_info</span> = <span style="color: #ff0000;">"!href=<span style="color: #000099; font-weight: bold;">\"</span>/user/(.+)<span style="color: #000099; font-weight: bold;">\"</span>!U"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$exp_info</span>,<span style="color: #0000ff;">$query</span>,<span style="color: #0000ff;">$user</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$t</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$t</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$titulo</span>&nbsp;&nbsp;&nbsp;= <span style="color: #0000ff;">$titulo</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$descripcion</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$descripcion</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$fecha</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>&amp;&amp;<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>&amp;&amp;<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">' de '</span>.<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">' de '</span>.<span style="color: #0000ff;">$fecha</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">''</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$tags</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$tags</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$user</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$user</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"id"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #0000ff;">$id</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"t"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"url"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$url</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"iurl"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #ff0000;">"http://img.youtube.com/vi/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"/2.jpg"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"reproductor"</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <span style="color: #ff0000;">"http://www.youtube.com/p.swf?video_id="</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"&amp;iurl=http://img.youtube.com/vi/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"/2.jpg&amp;t="</span>.<span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"video"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #ff0000;">"http://youtube.com/get_video.php?video_id="</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"&amp;t="</span>.<span style="color: #0000ff;">$t</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"html"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #ff0000;">"&lt;object width=<span style="color: #000099; font-weight: bold;">\"</span>425<span style="color: #000099; font-weight: bold;">\"</span> height=<span style="color: #000099; font-weight: bold;">\"</span>350<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;param name=<span style="color: #000099; font-weight: bold;">\"</span>movie<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>http://www.youtube.com/v/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/param&gt;&lt;param name=<span style="color: #000099; font-weight: bold;">\"</span>wmode<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>transparent<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/param&gt;&lt;embed src=<span style="color: #000099; font-weight: bold;">\"</span>http://www.youtube.com/v/"</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\"</span> type=<span style="color: #000099; font-weight: bold;">\"</span>application/x-shockwave-flash<span style="color: #000099; font-weight: bold;">\"</span> wmode=<span style="color: #000099; font-weight: bold;">\"</span>transparent<span style="color: #000099; font-weight: bold;">\"</span> width=<span style="color: #000099; font-weight: bold;">\"</span>425<span style="color: #000099; font-weight: bold;">\"</span> height=<span style="color: #000099; font-weight: bold;">\"</span>350<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;/embed&gt;&lt;/object&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"title"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$titulo</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <span style="color: #0000ff;">$descripcion</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"fecha"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$fecha</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"tags"</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #0000ff;">$tags</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"usuario"</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$user</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//sistema de diagnostico</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$salida</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'debug'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$query</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'la url de lectura es'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$url</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'lectura de video'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span>&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'t encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$t</span>&nbsp;&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'titulo encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp;&nbsp;&nbsp;= <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$titulo</span>&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'descripcion encontrada'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$descripcion</span>&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fecha encontrada'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fecha</span>&nbsp;&nbsp;<span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp; ? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tags encontrados'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tags</span>&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>&nbsp;? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'usuario encontrado'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$user</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;? <span style="color: #ff0000;">'si'</span> : <span style="color: #ff0000;">'no'</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'contenido para debug'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$salida</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>&nbsp; <span style="color: #0000ff;">$s</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$t</span> == <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//Error de conexion</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// todo OK</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$salida</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Un ejemplo con ID:</p>
<div class="igBar"><span id="lphp-35"><a href="#" onclick="javascript:showPlainTxt('php-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-35">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$datos</span> = youtube<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'aWCD69urAqQ'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$datos</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El mismo ejemplo de antes pero esta vez con la URL completa:</p>
<div class="igBar"><span id="lphp-36"><a href="#" onclick="javascript:showPlainTxt('php-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-36">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$datos</span> = youtube<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://es.youtube.com/watch?v=aWCD69urAqQ&amp;fmt=18'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#5589E4;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$datos</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<ins datetime="2009-07-06T21:07:55+00:00">He sacado una nueva version que corrige errores de peticion y caracteres. la podeis encontrar en <a href="http://www.tierra0.com/2009/07/06/funcion-de-extraccion-de-datos-youtube-en-php-version4/">Función de extracción de datos Youtube() en PHP version4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2009/02/13/funcion-de-extraccion-de-datos-youtube-en-php-version3/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

