<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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/"
	>

<channel>
	<title>Tierra0</title>
	<link>http://www.tierra0.com</link>
	<description>Es intentando lo imposible como se consigue lo posible</description>
	<pubDate>Thu, 07 Aug 2008 17:36:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<item>
		<title>mailTo(), envía correos de forma simple con PHP</title>
		<link>http://www.tierra0.com/2008/06/19/mailto-envia-correos-de-forma-simple-con-php/</link>
		<comments>http://www.tierra0.com/2008/06/19/mailto-envia-correos-de-forma-simple-con-php/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 22:36:52 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
		
		<category><![CDATA[Informatica]]></category>

		<category><![CDATA[Online]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/2008/06/19/mailto-envia-correos-de-forma-simple-con-php/</guid>
		<description><![CDATA[ La función que dejo hoy es un imprescindible en los proyectos de hoy en día. Se trata de una función para enviar mail a partir de las variables introducidas. La función directamente verifica si los mail introducidos como origen y destino están bien escritos y a demás verifica si es posible que existan (verifica [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img71.imageshack.us/img71/1613/stamp250pxon0.png" alt="sello" style="float:right;" /> La función que dejo hoy es un imprescindible en los proyectos de hoy en día. Se trata de una función para enviar mail a partir de las variables introducidas. La función directamente verifica si los mail introducidos como origen y destino están bien escritos y a demás verifica si es posible que existan (verifica si el hosting del mail si existe).</p>
<p>Las variables de la función son por orden:<br />
<strong>Asunto</strong>: El asunto del mail.<br />
<strong>Contenido</strong>: El contenido del mail.<br />
<strong>To_mail</strong>: Mail de destinatario.<br />
<strong>From_mail</strong>: Mail del usuario que lo envía.<br />
<strong>To_name</strong>: Nombre del usuario que recibirá el mail.<br />
<strong>From_name</strong>: Nombre del usuario que envía el mail.<br />
<strong>Type</strong>: Tipo de contenido del mail. Hay 3 opciones para esta variable. &#39;html&#39; como predeterminado para contenido HTML, &#39;both&#39; como contenido comodín o &#39;text&#39; como texto sin HTML (solo texto plano).<br />
<strong>Reply</strong>: Indica &#39;true&#39; o &#39;false&#39; para determinar si se quiere mostrar el mail de origen al destinatario. Si no se quiere mostrar se mostrará &#34;noreply&#34;.</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<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> mailTo<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$asunto</span>, <span style="color: #0000ff;">$contenido</span>, <span style="color: #0000ff;">$to_mail</span>, <span style="color: #0000ff;">$from_mail</span>=<span style="color: #ff0000;">&#8221;</span>, <span style="color: #0000ff;">$to_name</span>=<span style="color: #ff0000;">&#8221;</span>, <span style="color: #0000ff;">$from_name</span>=<span style="color: #ff0000;">&#8221;</span>, <span style="color: #0000ff;">$type</span>=<span style="color: #ff0000;">&#39;html&#39;</span>, <span style="color: #0000ff;">$reply</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: #808080; font-style: italic;"># test mail origen</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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/preg_match" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">preg_match</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;/^<span style="color: #000099; font-weight: bold;">\w</span>[-.<span style="color: #000099; font-weight: bold;">\w</span>]*@(<span style="color: #000099; font-weight: bold;">\w</span>[-._<span style="color: #000099; font-weight: bold;">\w</span>]*<span style="color: #000099; font-weight: bold;">\.</span>[a-zA-Z]{2,}.*)$/&#39;</span>, <span style="color: #0000ff;">$to_mail</span>, <span style="color: #0000ff;">$parse_mail_origen</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;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/function_exists" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">function_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;checkdnsrr&#39;</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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>&nbsp;!<a href="http://www.php.net/checkdnsrr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">checkdnsrr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$parse_mail_origen</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;.&#39;</span>,<span style="color: #ff0000;">&#39;MX&#39;</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; !<a href="http://www.php.net/checkdnsrr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">checkdnsrr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$parse_mail_origen</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;.&#39;</span>,<span style="color: #ff0000;">&#39;A&#39;</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$error</span>.=<span style="color: #ff0000;">&#39;el correo de origen no existe&#39;</span>.<span style="color: #ff0000;">&#34;&lt;br&gt;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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></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;">$error</span>.=<span style="color: #ff0000;">&#39;el correo de origen no es correcto&#39;</span>.<span style="color: #ff0000;">&#34;&lt;br&gt;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #808080; font-style: italic;"># test mail destino</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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/preg_match" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">preg_match</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;/^<span style="color: #000099; font-weight: bold;">\w</span>[-.<span style="color: #000099; font-weight: bold;">\w</span>]*@(<span style="color: #000099; font-weight: bold;">\w</span>[-._<span style="color: #000099; font-weight: bold;">\w</span>]*<span style="color: #000099; font-weight: bold;">\.</span>[a-zA-Z]{2,}.*)$/&#39;</span>, <span style="color: #0000ff;">$to_mail</span>, <span style="color: #0000ff;">$parse_mail</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;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/function_exists" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">function_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;checkdnsrr&#39;</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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>&nbsp;!<a href="http://www.php.net/checkdnsrr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">checkdnsrr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$parse_mail</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;.&#39;</span>,<span style="color: #ff0000;">&#39;MX&#39;</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; !<a href="http://www.php.net/checkdnsrr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">checkdnsrr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$parse_mail</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;.&#39;</span>,<span style="color: #ff0000;">&#39;A&#39;</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$error</span>.=<span style="color: #ff0000;">&#39;el correo de destino no existe&#39;</span>.<span style="color: #ff0000;">&#34;&lt;br&gt;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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; <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;&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$error</span>.=<span style="color: #ff0000;">&#39;el correo de destino no es correcto&#39;</span>.<span style="color: #ff0000;">&#34;&lt;br&gt;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; <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;">$error</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$error</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;"># composicion cabeceras</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;">$from_mail</span>==<span style="color: #ff0000;">&#8221;</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;">$from</span> = <span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;HTTP_HOST&#39;</span><span style="color: #66cc66;">&#93;</span> ? <span style="color: #ff0000;">&#39;noreply@&#39;</span>.<a href="http://www.php.net/substr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;HTTP_HOST&#39;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&#39;noreply@&#39;</span>.<a href="http://www.php.net/substr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;SERVER_NAME&#39;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">4</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;">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; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$from_name</span>!=<span style="color: #ff0000;">&#8221;</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;">$from</span>&nbsp; &nbsp;= <span style="color: #0000ff;">$reply</span> ? <span style="color: #0000ff;">$from_name</span>.<span style="color: #ff0000;">&#39;&lt;&#39;</span>.<span style="color: #0000ff;">$from_mail</span>.<span style="color: #ff0000;">&#39;&gt;&#39;</span>&nbsp; &nbsp;: <span style="color: #0000ff;">$from_name</span>.<span style="color: #ff0000;">&#39;&lt;&#39;</span>.<span style="color: #ff0000;">&#39;noreply@&#39;</span>.<span style="color: #0000ff;">$parse_mail</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;&gt;&#39;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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> <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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$from</span>&nbsp; &nbsp;= <span style="color: #0000ff;">$reply</span> ? <span style="color: #0000ff;">$from_mail</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span style="color: #ff0000;">&#39;noreply@&#39;</span>.<span style="color: #0000ff;">$parse_mail</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; &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: #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: #0000ff;">$to</span>&nbsp;&nbsp;&nbsp; = <span style="color: #0000ff;">$to_name</span>==<span style="color: #ff0000;">&#8221;</span> ? <span style="color: #0000ff;">$to_mail</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;: <span style="color: #0000ff;">$to_name</span>.<span style="color: #ff0000;">&#39;&lt;&#39;</span>.<span style="color: #0000ff;">$to_mail</span>.<span style="color: #ff0000;">&#39;&gt;&#39;</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;">$return_path</span> = <span style="color: #0000ff;">$reply</span>&nbsp; &nbsp;&nbsp; &nbsp;? <span style="color: #ff0000;">&#39;&lt;&#39;</span>.<span style="color: #0000ff;">$from_mail</span>.<span style="color: #ff0000;">&#39;&gt;&#39;</span>&nbsp; &nbsp;: <span style="color: #ff0000;">&#39;&lt;&#39;</span>.<span style="color: #ff0000;">&#39;noreply@&#39;</span>.<span style="color: #0000ff;">$parse_mail</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;&gt;&#39;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$subject</span>&nbsp; &nbsp;&nbsp; = <span style="color: #0000ff;">$yourSubject</span>.<span style="color: #ff0000;">&#39;: &#39;</span>.<a href="http://www.php.net/stripslashes" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">stripslashes</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$sub</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;">$date</span>&nbsp; &nbsp;&nbsp; &nbsp; = <a href="http://www.php.net/date" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#34;d-M-y H:i&#34;</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;">$boundary</span>&nbsp; &nbsp; = <a href="http://www.php.net/md5" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">md5</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$from_mail</span>.<span style="color: #0000ff;">$to_mail</span>.<span style="color: #0000ff;">$asunto</span>.<span style="color: #0000ff;">$contenido</span>.<span style="color: #0000ff;">$type</span>.<span style="color: #0000ff;">$reply</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//id unica para este contenido de mail</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;">$headers</span>&nbsp; &nbsp;&nbsp; = <span style="color: #ff0000;">&#34;From: $from<span style="color: #000099; font-weight: bold;">\n</span>Reply-To: $from<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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;">$headers</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;X-Mailer:PHP/&#34;</span>.<a href="http://www.php.net/phpversion" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">phpversion</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$headers</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Mime-Version: 1.0<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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;">$headers</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Content-Type: multipart/alternative; boundary=<span style="color: #000099; font-weight: bold;">\&#34;</span>{$boundary}<span style="color: #000099; font-weight: bold;">\&#34;</span><span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$headers</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Return-Path: $return_path<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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: #808080; font-style: italic;"># composicion de 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;">$message</span>&nbsp; &nbsp;&nbsp; = <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#8211;{$boundary}<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">switch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$type</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;">case</span> <span style="color: #ff0000;">&#39;html&#39;</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Content-Type: text/html; charset=ISO-8859-1<span style="color: #000099; font-weight: bold;">\n</span>Content-Transfer-Encoding: quoted-printable<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>$contenido&#34;</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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#8211;{$boundary}&#8211;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">break</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;">case</span> <span style="color: #ff0000;">&#39;text&#39;</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Content-Type: text/plain; charset=ISO-8859-1<span style="color: #000099; font-weight: bold;">\n</span>Content-Transfer-Encoding: quoted-printable<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>$contenido&#34;</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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#8211;{$boundary}&#8211;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$message</span>&nbsp; &nbsp;&nbsp; = <a href="http://www.php.net/strip_tags" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">strip_tags</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/stripslashes" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">stripslashes</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$message</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; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">case</span> <span style="color: #ff0000;">&#39;both&#39;</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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;Content-Type: text/plain; charset=ISO-8859-1<span style="color: #000099; font-weight: bold;">\n</span>Content-Transfer-Encoding: quoted-printable<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>$contenido&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$message</span>&nbsp; &nbsp; .= <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#8211;{$boundary}&#8211;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&#34;</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: #b1b100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #808080; font-style: italic;"># envio</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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> <a href="http://www.php.net/mail" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">mail</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$to</span>, <span style="color: #0000ff;">$asunto</span>, <span style="color: #0000ff;">$message</span>, <span style="color: #0000ff;">$headers</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>Al usar la función puede dar como resultado un binario indicando si se ha enviado o no el mail o un string de texto indicando si hay algún error con las direcciones.</p>
<p>Ejemplo basico:</p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showPlainTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> mailto<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;Asunto del email&#39;</span>, <span style="color: #ff0000;">&#39;&lt;b&gt;contenido del email a enviar!&lt;/b&gt;&#39;</span>, <span style="color: #ff0000;">&#39;email_de_destinatario@gmail.com&#39;</span><span style="color: #66cc66;">&#41;</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; <a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;Mail enviado&#39;</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" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;Error al enviar el mail&#39;</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>
<li style="font-family: 'Courier 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>Ejemplo completo mail de origen oculto:</p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<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;">&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: #0000ff;">$mail</span> = mailto<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;Asunto del email&#39;</span>, <span style="color: #ff0000;">&#39;&lt;b&gt;contenido del email a enviar!&lt;/b&gt;&#39;</span>, <span style="color: #ff0000;">&#39;email_de_destinatario@gmail.com&#39;</span>, <span style="color: #ff0000;">&#39;email_de_origen@yahoo.es&#39;</span>, <span style="color: #ff0000;">&#39;text&#39;</span>, <span style="color: #000000; font-weight: bold;">false</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;">$mail</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; <a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;Mail enviado&#39;</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" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;Error al enviar el mail&#39;</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>
<li style="font-family: 'Courier 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>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2008/06/19/mailto-envia-correos-de-forma-simple-con-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lang_detect(), detecta en que lenguaje esta un texto con PHP</title>
		<link>http://www.tierra0.com/2008/06/08/lang_detect-detecta-en-que-lenguaje-esta-un-texto-con-php/</link>
		<comments>http://www.tierra0.com/2008/06/08/lang_detect-detecta-en-que-lenguaje-esta-un-texto-con-php/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 17:38:23 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/2008/06/08/lang_detect-detecta-en-que-lenguaje-esta-un-texto-con-php/</guid>
		<description><![CDATA[Si, con todos los diccionarios online y con todos los traductores que existen hoy en día es muy fácil cambiar un texto de un lenguaje a otro pero, ¿como saber en que lenguaje esta para decidir que idioma de origen seleccionamos?
Pues como siempre, google al rescate!. La Google AJAX Language API nos ayuda a decidirlo [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img92.imageshack.us/img92/5466/languagebooksei1.gif" alt="libreria de idiomas" style="float:right; width:50%; margin:3px; margin-top:8px; margin-top:8px;" />Si, con todos los diccionarios online y con todos los traductores que existen hoy en día es muy fácil cambiar un texto de un lenguaje a otro pero, ¿como saber en que lenguaje esta para decidir que idioma de origen seleccionamos?<br />
Pues como siempre, google al rescate!. La <a href="http://code.google.com/apis/ajaxlanguage/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">Google AJAX Language API</a> nos ayuda a decidirlo a partir de un simple extracto, y como siempre, para no complicarnos os dejo una función sencilla y unos ejemplos.</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;"><span style="color: #000000; font-weight: bold;">function</span> lang_detect<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$texto</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;">$url</span> = <span style="color: #ff0000;">&#39;http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&amp;q=&#39;</span>.<a href="http://www.php.net/urlencode" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$texto</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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/strlen" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">strlen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>&gt;<span style="color: #cc66cc;color:#800000;">2000</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #0000ff;">$url</span> = <a href="http://www.php.net/substr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><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;">1999</span><span style="color: #66cc66;">&#41;</span>; <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: #0000ff;">$response</span> = <a href="http://www.php.net/file_get_contents" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><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; <a href="http://www.php.net/preg_match_all" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;!{&quot;responseData&quot;: {&quot;language&quot;:&quot;(.+)&quot;,&quot;isReliable&quot;:(.+),&quot;confidence&quot;:(.+)}, &quot;responseDetails&quot;: (.+), &quot;responseStatus&quot;: (.+)}!U&#39;</span>,<span style="color: #0000ff;">$response</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; <span style="color: #0000ff;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;language&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$s</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;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;isReliable&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$s</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>;</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;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;confidence&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #0000ff;">$s</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>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;responseDetails&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;= <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</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;">$o</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;responseStatus&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp; = <span style="color: #0000ff;">$s</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">5</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: #b1b100;">return</span> <span style="color: #0000ff;">$o</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" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$o</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;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La primera y única variable que usa lang_detect() es el texto del que queremos saber en que idioma esta. Como resultado nos dará un array con varios datos como el factor de acierto que puede tener la detección (<code>confidence</code>) o el lenguaje en el que esta escrito (<code>language</code>).<br />
Para mas información sobre el resto de parámetros devueltos podéis leer la <a href="http://code.google.com/apis/ajaxlanguage/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">documentación</a>.</p>
<p>Ejemplo uno texto e italiano:</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<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;">$texto</span> = <span style="color: #ff0000;">&#39;ciao mondo crudele&#39;</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;">$resultado</span> = lang_detect<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$texto</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;"><a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> resultado<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;language&#39;</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ejemplo dos, texto en español:</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<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;">$texto</span> = <span style="color: #ff0000;">&#39;Hola mundo!!&#39;</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;">$resultado</span> = lang_detect<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$texto</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;"><a href="http://www.php.net/print_r" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">print_r</span></a><span style="color: #66cc66;">&#40;</span>resultado<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2008/06/08/lang_detect-detecta-en-que-lenguaje-esta-un-texto-con-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Revision del proyecto Proyector Laser de video</title>
		<link>http://www.tierra0.com/2008/06/05/revision-del-proyecto-proyector-laser-de-video/</link>
		<comments>http://www.tierra0.com/2008/06/05/revision-del-proyecto-proyector-laser-de-video/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 23:05:44 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
		
		<category><![CDATA[Imagenes]]></category>

		<category><![CDATA[Informatica]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/2008/06/05/revision-del-proyecto-proyector-laser-de-video/</guid>
		<description><![CDATA[Hace ya mas de año y pico que publique la idea de realizar una pantalla de alta definición casera a partir del movimiento de 3 punteros láser y después de tantos comentarios y visitas al tema creo que ha llegado la hora de aclararnos un poco sobre que se pretende conseguir y cuales son los [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img66.imageshack.us/img66/6821/lasertv1cg8.png" alt="proyector laser RGB" style="float:right; width:200px" />Hace ya mas de año y pico que publique la <a href="http://www.tierra0.com/2007/01/02/proyector-laser-casero/" >idea</a> de realizar una pantalla de alta definición casera a partir del movimiento de 3 punteros láser y después de tantos comentarios y visitas al tema creo que ha llegado la hora de aclararnos un poco sobre que se pretende conseguir y cuales son los pasos para conseguirlo.</p>
<p>La idea principal era realizar una pantalla <a href="http://es.wikipedia.org/wiki/Hardware_abierto" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">OpenHardware</a>, que <strong>cualquiera pudiera mejorar </strong>mientras decidan <strong>compartir esas mejoras con los demás</strong>. De esta manera todos tendremos pantallas de bajo coste y podremos hacer llegar la información a mas lugares. Por esto una de las principales cosas que buscaba era que fuera de montaje sencillo y asequible, para que no fuera muy costoso para cualquiera poder experimentar.</p>
<p>Por todo esto y para empezar unificando pense en utiizar como referencia los conectores que mas se utilizan desde que puse el articulo hasta la actualizad, los conectores <a href="http://es.wikipedia.org/wiki/VGA" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">VGA</a>. Estos permiten utilizar salidas independientes para <a href="http://es.wikipedia.org/wiki/Modelo_de_color_RGB" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">cada color</a> (<a href="http://es.wikipedia.org/wiki/Modelo_de_color_RGB" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">Rojo, Verde y Azul</a>) y a demas tomar una <a href="http://es.wikipedia.org/wiki/Onda_cuadrada" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">señal cuadrada</a> que indica cuando cambia de linea o de punto (<a href="http://es.wikipedia.org/wiki/Video_%28Señal%29#Sincronismos" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">sincronismo</a> vertical u horizontal). Pero de todas formas para realizar esta idea hace falta superar algunos retos electrónicos y opticos:</p>
<p>Como ya se comento en el <a href="http://www.tierra0.com/2007/01/02/proyector-laser-casero/" >anterior articulo</a>, el ingenio funcionaria a partir de unas piezas espejadas móviles que orientaran los haces de luz a cada punto de la pantalla. Esto se conseguiría utilizando un primer sistema que moviera el haz de derecha a izquierda creando lineas de puntos, y un segundo que moviera cada linea un punto mas abajo creando los cuadros de imagen. La utilización de esta tecnología hace que el tamaño y resolución de la pantalla pueda ser cambiado digitalmente sin utilizar piezas adicionales (llegando hasta unos limites claro).</p>
<p><embed src='http://img511.imageshack.us/img511/1746/altavozlaserscene1oh7.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='200' height="150" style="float:right;"></embed>El primer reto a superar para conseguirlo seria realizar un sistema espejado que pueda moverse al menos a 50Hz. En un primer momento para mejorar el montaje se opto por utilizar motores de CD o DVD viejos para conseguir la velocidad necesaria utilizando un engranaje dentado para hacer reflejar los haces de luz, pero pronto comunicaron que esto era igual de facil de montar como de que las lineas se vieran <a href="http://www.tierra0.com/2007/01/02/proyector-laser-casero/#comment-49" >borrosas</a> por la sujeción de los elementos. Por lo tanto creo que volvemos a la opción inicial.<br />
Podríamos utilizar un altavoz, como sistema móvil, espejeando su membrana a partir de un <a href="http://www.ribertintas.com.br/PainelControle/images/produtos/IMG_0015.JPG" onclick="javascript:urchinTracker ('/outbound/article/www.ribertintas.com.br');">spray cromado</a> o utilizando algún recubrimiento de este tipo y acoplarle un circuito de <a href="http://es.wikipedia.org/wiki/Transistor" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">transistor</a> que utilice las señales de salida de sincronismo del conector <a href="http://es.wikipedia.org/wiki/VGA" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">VGA</a> (pines13-5 y 15-10) para, directamente sin mas controladores se produzca la vibración. Lo que no se, es si tendríamos que utilizar algún elemento mas entre medias para conectarlo y poder por lo tanto hacer que la potencia en el altavoz sea suficiente.</p>
<p><img src="http://img241.imageshack.us/img241/332/vga2arcadebi3.gif" alt="esquema de Pines VGA" width="300px" style="float:left; margin:8px"/>El segundo reto seria crear un circuito electrónico que permita, a partir de la potencia de cada color poder pasar la potencia proporcional al láser. Esto seria muy parecido al anterior&#8230; con un circuito de transistor que permita variar a partir de 2 potenciómetros la tensión máxima y mínima de entrada al láser nos iría genial. de esa manera podríamos regular la cromática del conjunto por separado.</p>
<p><img src="http://img142.imageshack.us/img142/9854/distorsionalineacionhazqa1.png" alt="Difraccion de haces laser" style="float:right;;" width="250" />El ultimo reto sería óptico..<br />
3 láser de respectivos colores para formar un punto de color necesitan estar muy bien alineados para que no desdoblen la imagen, lo que ahora se consigue con espejos que filtran espectros de color. Y este es el punto flaco del proyecto. Si utilizamos un solo conjunto móvil para los 3 láser hay que unificarlos antes de proyectarlos contra el primer espejo, por lo que a mi solo se me ha ocurrido utilizar fibra óptica. Un hilo de fibra óptica se conectaría a cada láser unificando las puntas de los 3 en un solo extremo que enfocaríamos hacia el espejo, el efecto seria casi el mismo que el de las <a href="http://es.wikipedia.org/wiki/Imagen:Plasma-display-composition.svg" onclick="javascript:urchinTracker ('/outbound/article/es.wikipedia.org');">pantallas actuales de pixeles</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tierra0.com/2008/06/05/revision-del-proyecto-proyector-laser-de-video/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Vimeo(), descarga los datos de los vídeos que hay en vimeo incluyendo los FLV</title>
		<link>http://www.tierra0.com/2008/06/04/vimeo-descarga-los-datos-de-los-videos-que-hay-en-vimeo-incluyendo-los-flv/</link>
		<comments>http://www.tierra0.com/2008/06/04/vimeo-descarga-los-datos-de-los-videos-que-hay-en-vimeo-incluyendo-los-flv/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 08:34:05 +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/2008/06/04/vimeo-descarga-los-datos-de-los-videos-que-hay-en-vimeo-incluyendo-los-flv/</guid>
		<description><![CDATA[Una vez pasado el tema de que youtube es el sistema mas viral y usado por los niños y jóvenes de hoy en día para subir los vídeos y compartirlos en internet, este servicio en cuanto a diseño y resolución deja bastante que desear&#8230; lo que ha solucionado perfectamente Vimeo.
Vimeo.com es una web para compartir [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img220.imageshack.us/img220/5364/vimeode1.jpg" alt="vimeo" style="float:right;margin:3px;"/>Una vez pasado el tema de que youtube es el sistema mas viral y usado por los niños y jóvenes de hoy en día para subir los vídeos y compartirlos en internet, este servicio en cuanto a diseño y resolución deja bastante que desear&#8230; lo que ha solucionado perfectamente <a href="http://www.vimeo.com/" onclick="javascript:urchinTracker ('/outbound/article/www.vimeo.com');">Vimeo</a>.</p>
<p>Vimeo.com es una web para compartir vídeos en resolución normal o HD que permite subir hasta 500m a la semana. Su diseño es impecable, con una buena implementación de Ajax y unos colores llamativos que aumentan su atractivo, pero las ventajas no solo acaban ahí. También implementa una serie de archivos dinámicos en XML documentados y no documentados en su API que nos permiten obtener los datos de un video directamente con una rápida consulta.</p>
<p>Como ejemplo y imitando a mi función de <a href="http://www.tierra0.com/2008/01/24/funcion-de-extraccion-de-datos-youtube-en-php-version2/" ><code>Youtube()</code></a> he creado <code>vimeo()</code> que a partir del numero de ID que todos los vídeos tienen como prefijo en su URL, muestra todos los datos, incluyendo el link al video FLV que podremos reproducir no solo en su player si no que en el nuestro mismo..</p>
<div class="igBar"><span id="lphp-15"><a href="#" onclick="javascript:showPlainTxt('php-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-15">
<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: #000000; font-weight: bold;">function</span> vimeo<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$id</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: #0000ff;">$xml</span>&nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/file_get_contents" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">file_get_contents</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;http://www.vimeo.com/moogaloop/load/clip:&#39;</span>.<span style="color: #0000ff;">$id</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;">$flv</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #ff0000;">&#39;http://www.vimeo.com/moogaloop/play/clip:&#39;</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">&#39;/&#39;</span>.<span style="color: #0000ff;">$request_signature</span>.<span style="color: #ff0000;">&#39;/&#39;</span>.<span style="color: #0000ff;">$request_signature_expires</span>.<span style="color: #ff0000;">&#39;/?q=&#39;</span>.<span style="color: #0000ff;">$hd</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">$strings</span>&nbsp; &nbsp; = <a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><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; <span style="color: #ff0000;">&#39;timestamp&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;timestamp&gt;(.+)&lt;/timestamp&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;locked&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;locked&gt;(.+)&lt;/locked&gt;&#39;</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;">&#39;caption&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;caption&gt;&lt;![CDATA[(.+)]]&gt;&lt;/caption&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;isLoggedIn&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;isLoggedIn&gt;(.+)&lt;/isLoggedIn&gt;&#39;</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;">&#39;isOwner&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;isOwner&gt;(.+)&lt;/isOwner&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;likeIt&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;likeIt&gt;(.+)&lt;/likeIt&gt;&#39;</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;">&#39;default_volume&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;default_volume&gt;(.+)&lt;/default_volume&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;hd_preference&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;hd_preference&gt;(.+)&lt;/hd_preference&gt;&#39;</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;">&#8217;scaling_preference&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;scaling_preference&gt;(.+)&lt;/scaling_preference&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;file&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;file&gt;(.+)&lt;/file&gt;&#39;</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;">&#39;hd_file&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;hd_file&gt;(.+)&lt;/hd_file&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;width&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;width&gt;(.+)&lt;/width&gt;&#39;</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;">&#39;height&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;height&gt;(.+)&lt;/height&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;duration&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;duration&gt;(.+)&lt;/duration&gt;&#39;</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;">&#39;thumbnail&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;thumbnail&gt;(.+)&lt;/thumbnail&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;totalComments&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;totalComments&gt;(.+)&lt;/totalComments&gt;&#39;</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;">&#39;totalLikes&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;totalLikes&gt;(.+)&lt;/totalLikes&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;totalPlays&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;totalPlays&gt;(.+)&lt;/totalPlays&gt;&#39;</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;">&#39;url_clean&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;url_clean&gt;(.+)&lt;/url_clean&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;url_&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;url&gt;&lt;![CDATA[(.+)]]&gt;&lt;/url&gt;&#39;</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;">&#39;uploader_url&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;uploader_url&gt;&lt;![CDATA[(.+)]]&gt;&lt;/uploader_url&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;uploader_portrait&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;uploader_portrait&gt;(.+)&lt;/uploader_portrait&gt;&#39;</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;">&#39;uploader_display_name&#39;</span>&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;uploader_display_name&gt;(.+)&lt;/uploader_display_name&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;nodeId&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;nodeId&gt;(.+)&lt;/nodeId&gt;&#39;</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;">&#39;isHD&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;isHD&gt;(.+)&lt;/isHD&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;isPrivate&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;isPrivate&gt;(.+)&lt;/isPrivate&gt;&#39;</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;">&#39;isPassword&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;isPassword&gt;(.+)&lt;/isPassword&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;isNobody&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;isNobody&gt;(.+)&lt;/isNobody&gt;&#39;</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;">&#39;embed_code&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;embed_code&gt;&lt;![CDATA[(.+)]]&gt;&lt;/embed_code&gt;&lt;/video&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;caption&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;caption&gt;&lt;![CDATA[(.+)]]&gt;&lt;/caption&gt;&#39;</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;">&#39;thumbnail&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;thumbnail&gt;(.+)&lt;/thumbnail&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;url&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;url&gt;&lt;(.+)&gt;&lt;/url&gt;&#39;</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;">&#39;nodeId&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;nodeId&gt;(.+)&lt;/nodeId&gt;&lt;/video&gt;&lt;/stream_clips&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#8217;source&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;source&gt;(.+)&lt;/source&gt;&#39;</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;">&#39;referrer&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;referrer&gt;(.+)&lt;/referrer&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#8217;server&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;server&gt;(.+)&lt;/server&gt;&#39;</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;">&#8217;show_title&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;show_title&gt;(.+)&lt;/show_title&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#8217;show_byline&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;show_byline&gt;(.+)&lt;/show_byline&gt;&#39;</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;">&#8217;show_portrait&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;show_portrait&gt;(.+)&lt;/show_portrait&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;color&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;color&gt;(.+)&lt;/color&gt;&#39;</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;">&#39;fullscreen&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;fullscreen&gt;(.+)&lt;/fullscreen&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;fulloutro&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;fulloutro&gt;(.+)&lt;/fulloutro&gt;&#39;</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;">&#39;is_facebook&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;is_facebook&gt;(.+)&lt;/is_facebook&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;context&#39;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;context&gt;(.+)&lt;/context&gt;&#39;</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;">&#39;context_id&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;context_id&gt;(.+)&lt;/context_id&gt;&lt;/flash_default_vars&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;cached_timestamp&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;cached_timestamp&gt;(.+)&lt;/cached_timestamp&gt;&#39;</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;">&#39;is_mod&#39;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color: #ff0000;">&#39;&lt;is_mod&gt;(.+)&lt;/is_mod&gt;&#39;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#39;request_signature&#39;</span>&nbsp;&nbsp;&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;request_signature&gt;(.+)&lt;/request_signature&gt;&#39;</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;">&#39;request_signature_expires&#39;</span>&nbsp;&nbsp;=&gt; <span style="color: #ff0000;">&#39;&lt;request_signature_expires&gt;(.+)&lt;/request_signature_expires&gt;&#39;</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;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strings</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; <a href="http://www.php.net/preg_match_all" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">preg_match_all</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;!&#39;</span>.<a href="http://www.php.net/str_replace" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;![CDATA[&#39;</span>, <span style="color: #ff0000;">&#39;]]&#39;</span><span style="color: #66cc66;">&#41;</span>, <a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8221;</span>, <span style="color: #ff0000;">&#8221;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$v</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&#39;!U&#39;</span>, <span style="color: #0000ff;">$xml</span>, <span style="color: #0000ff;">$o</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: #0000ff;">$k</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$o</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: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&#39;![CDATA[&#39;</span><span style="color: #66cc66;">&#41;</span> ? <a href="http://www.php.net/substr" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$o</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: #cc66cc;color:#800000;">8</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: #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: #66cc66;">&#125;</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;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;flv_video&#39;</span><span style="color: #66cc66;">&#93;</span>&nbsp; = <span style="color: #ff0000;">&#39;http://&#39;</span>.<span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8217;server&#39;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;/moogaloop/play/clip:&#39;</span>.<span style="color: #0000ff;">$id</span>.<span style="color: #ff0000;">&#39;/&#39;</span>.<span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;request_signature&#39;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;/&#39;</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;">&#39;flv_video&#39;</span><span style="color: #66cc66;">&#93;</span> .= <span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;request_signature_expires&#39;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&#39;/?q=&#39;</span>.<span style="color: #0000ff;">$out</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;isHD&#39;</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: #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>
<li style="font-family: 'Courier 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>Muestra los datos del video <a href="http://www.vimeo.com/1084537" onclick="javascript:urchinTracker ('/outbound/article/www.vimeo.com');">Big Buck Bunny</a> con <code>ID:1084537</code>.</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showPlainTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<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;">&nbsp; &nbsp; <a href="http://www.php.net/print_r" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">print_r</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; vimeo<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;1084537&#39;</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;">&#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></p>
<p>Como en la anterior función de <a href="http://www.tierra0.com/2008/01/24/funcion-de-extraccion-de-datos-youtube-en-php-version2/" >youtube()</a> esta solo funciona si los archivos son públicos.. para dudas o errores, abajo comentarios <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/2008/06/04/vimeo-descarga-los-datos-de-los-videos-que-hay-en-vimeo-incluyendo-los-flv/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hack para Phoogle, abre los globos de información desde fuera del mapa</title>
		<link>http://www.tierra0.com/2008/05/09/hack-para-phoogle-abre-los-globos-de-informacion-desde-fuera-del-mapa/</link>
		<comments>http://www.tierra0.com/2008/05/09/hack-para-phoogle-abre-los-globos-de-informacion-desde-fuera-del-mapa/#comments</comments>
		<pubDate>Fri, 09 May 2008 17:10:35 +0000</pubDate>
		<dc:creator>antares500</dc:creator>
		
		<category><![CDATA[Informatica]]></category>

		<category><![CDATA[Online]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tierra0.com/2008/05/09/hack-para-phoogle-abre-los-globos-de-informacion-desde-fuera-del-mapa/</guid>
		<description><![CDATA[Phoogle es una fantástica clase para manejar la API de GoogleMaps y poder generar en unas cuantas lineas mapas simples y funcionales. El único problema podría ser la limitación que tiene a la hora de desarrollar nuevas operaciones.
Mi problema era que quería que, al pinchar en un enlace apareciera el globo de texto asociado mostrando [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img366.imageshack.us/img366/9376/earthtu9.png" alt="Tierra con chincheta transparente" style="margin:3px; float:right;" /><a href="http://www.systemsevendesigns.com/phoogle" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">Phoogle</a> es una fantástica clase para manejar la <a href="http://code.google.com/apis/maps/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">API de GoogleMaps</a> y poder generar en unas cuantas lineas mapas simples y funcionales. El único problema podría ser la limitación que tiene a la hora de desarrollar nuevas operaciones.</p>
<p>Mi problema era que quería que, al pinchar en un enlace apareciera el globo de texto asociado mostrando la ubicación. Esta funcion la habia <a href="http://www.phpinsider.com/php/code/GoogleMapAPI/demo/" onclick="javascript:urchinTracker ('/outbound/article/www.phpinsider.com');">visto</a> con la clase <a href="http://www.phpinsider.com/php/code/GoogleMapAPI/" onclick="javascript:urchinTracker ('/outbound/article/www.phpinsider.com');">GoogleMapAPI.class.php</a> y pensaba que <a href="http://www.systemsevendesigns.com/phoogle" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">Phoogle</a> tambien lo podria hacer pero, <a href="http://www.systemsevendesigns.com/phoogle/one_point/" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">vistos</a> <a href="http://www.systemsevendesigns.com/phoogle/multiple_points/" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">los</a> <a href="http://www.systemsevendesigns.com/phoogle/display_points/" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">ejemplos</a> me di cuenta que <a href="http://www.systemsevendesigns.com/phoogle/custom_info_window/" onclick="javascript:urchinTracker ('/outbound/article/www.systemsevendesigns.com');">no</a>, asi que me puse manos a la obra para aplicar alguna pequeña mejora y poder realizarlo de una manera simple.</p>
<p>Para hacerlo he realizado unas pequeñas modificaciones.<br />
En el archivo que podéis descargar de aquí, entramos y modificamos las siguientes lineas:</p>
<p>Despues de la linea 241, donde aparece:</p>
<div class="igBar"><span id="lphp-23"><a href="#" onclick="javascript:showPlainTxt('php-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-23">
<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;"><a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#34;&nbsp; &nbsp; &lt;script type=<span style="color: #000099; font-weight: bold;">\&#34;</span>text/javascript<span style="color: #000099; font-weight: bold;">\&#34;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
insertamos esto:</p>
<div class="igBar"><span id="lphp-24"><a href="#" onclick="javascript:showPlainTxt('php-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-24">
<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;"><a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#34;var markers = [];<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;function click_sidebar(idx, contenido) {&#39;</span> . <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; <a href="http://www.php.net/echo" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;&nbsp; markers[idx].openInfoWindowHtml(contenido);&#39;</span> . <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</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" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&#39;}&#39;</span> . <span style="color: #ff0000;">&#34;<span style="color: #000099; font-weight: bold;">\n</span>&#34;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En la que ahora será la linea 278, después de:</p>
<div class="igBar"><span id="lphp-25"><a href="#" onclick="javascript:showPlainTxt('php-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-25">
<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;">map.addOverlay<span style="color: #66cc66;">&#40;</span>marker<span style="color: #ff0000;">&#34;.$g.&#34;</span><span style="color: #66cc66;">&#41;</span>\n </div>
</li>
</ol>
</div>
</div>
</div>
<p>
insertamos:</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;">markers<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#34;.$g.&#34;</span><span style="color: #66cc66;">&#93;</span> = marker<span style="color: #ff0000;">&#34;.$g.&#34;</span>;\n </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Con esta modificacion podremos utilizar una nueva funcion <strong>javascript</strong> llamada <code>click_sidebar()</code>. A esta función le pasaremos 2 parámetros, el primero es el numero de &#34;dirección&#34; al que queremos llamar (la primera es 0, la segunda 1&#8230;.). El segundo parámetro será el contenido del globo de información.<br />
Ejemplo: <code>&lt;a href="#" onclick="javascript:click_sidebar('0', 'primer punto del mapa');return false;">texto del link&lt;/a></code>.</p>
<p>Lo mejor para despejar dudas será un ejemplo practico amplio..<br />
Para el ejemplo usaremos 2 archivos que estarán en la misma parpeta dentro del servidor:</p>
<p>Archivo phogle.php (version Phoogle Maps 2.0) CON LA MODIFICACIÓN REALIZADA! más la función de obtención de APIKEY automatica:</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: #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;">&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: #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;"><span style="color: #808080; font-style: italic;">* Phoogle Maps 2.0 | Uses Google Maps API to create customizable maps</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* that can be embedded on your website</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;">*&nbsp; &nbsp; Copyright (C) 2005&nbsp; Justin Johnson</span></div>
</li>
<li style="font-family: 'Courier 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: #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;"><span style="color: #808080; font-style: italic;">*&nbsp; &nbsp; This program is free software; you can redistribute it and/or modify</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">*&nbsp; &nbsp; it under the terms of the GNU General Public License as published by</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;">*&nbsp; &nbsp; the Free Software Foundation; either version 2 of the License, or</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">*&nbsp; &nbsp; (at your option) any later version.</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;">*</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">*&nbsp; &nbsp; This program is distributed in the hope that it will be useful,</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;">*&nbsp; &nbsp; but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">*&nbsp; &nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the</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;">*&nbsp; &nbsp; GNU General Public License for more details.</span></div>
</li>
<li style="font-family: 'Courier 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: #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;"><span style="color: #808080; font-style: italic;">*&nbsp; &nbsp; You should have received a copy of the GNU General Public License</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">*&nbsp; &nbsp; along with this program; if not, write to the Free Software</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;">*&nbsp; &nbsp; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA&nbsp; 02111-1307&nbsp; USA </span></div>
</li>
<li style="font-family: 'Courier 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: #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;"><span style="color: #808080; font-style: italic;">*</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* Phoogle Maps 2.0</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;">* Uses Google Maps Mapping API to create customizable</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* Google Maps that can be embedded on your website</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;">*</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* @class&nbsp; &nbsp; &nbsp; &nbsp; Phoogle Maps 2.0</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;">* @author&nbsp; &nbsp; &nbsp; &nbsp;Justin Johnson &lt;justinjohnson@system7designs.com&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: #808080; font-style: italic;">* @copyright&nbsp; &nbsp; 2005 system7designs</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', 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;</div>
</li>
<li style="font-family: 'Courier New', 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;</div>
</li>
<li style="font-family: 'Courier 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;">class</span> PhoogleMap<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;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* validPoints : array</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;">* Holds addresses and HTML Messages for points that are valid (ie: have longitude and latitutde)</span></div>
</li>
<li style="font-family: 'Courier 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: #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; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$validPoints</span> = <a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span style="color: #000066;">array</span></a><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;"><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;"><span style="color: #808080; font-style: italic;">* invalidPoints : array</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* Holds addresses and HTML Messages for points that are invalid (ie: don&#39;t have longitude and latitutde)</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">var</span> <span style="color: #0000ff;">$invalidPoints</span> = <a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><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;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* mapWidth</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;">* width of the Google Map, in pixels</span></div>
</li>
<li style="font-family: 'Courier 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: #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; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$mapWidth</span> = <span style="color: #cc66cc;color:#800000;">300</span>;</div>
</li>
<li style="font-family: 'Courier 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: #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;"><span style="color: #808080; font-style: italic;">* mapHeight</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* height of the Google Map, in pixels</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">var</span> <span style="color: #0000ff;">$mapHeight</span> = <span style="color: #cc66cc;color:#800000;">300</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: #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;"><span style="color: #808080; font-style: italic;">* apiKey</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* Google API Key</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">var</span> <span style="color: #0000ff;">$apiKey</span> = <span style="color: #ff0000;">&#34;&#34;</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: #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;"><span style="color: #808080; font-style: italic;">* showControl</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* True/False whether to show map controls or not</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">var</span> <span style="color: #0000ff;">$showControl</span> = <span style="color: #000000; font-weight: bold;">true</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: #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;"><span style="color: #808080; font-style: italic;">* showType</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* True/False whether to show map type controls or not</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">var</span> <span style="color: #0000ff;">$showType</span> = <span style="color: #000000; font-weight: bold;">true</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;">/**</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* controlType</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;">* string: can be &#8217;small&#39; or &#39;large&#39;</span></div>
</li>
<li style="font-family: 'Courier 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: #808080; font-style: italic;">* display&#8217;s either the large or the small controls on the map, small by default</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;">*/</span></div>
</li>
<li style="font-family: 'Courier New', 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: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$controlType</span> = <span style="color: #ff0000;">&#8217;small&#39;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: norma