<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comentarios en: Función PHP para detectar un móvil y redirigir</title>
	<atom:link href="http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/feed/" rel="self" type="application/rss+xml" />
	<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/</link>
	<description>gafeman, miquel, pagerank, SEO, apple, PHP, web 2.0, wordpress, diseño, musica</description>
	<lastBuildDate>Tue, 07 Feb 2012 07:13:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Por: Bernabé Borrero</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-44979</link>
		<dc:creator>Bernabé Borrero</dc:creator>
		<pubDate>Sat, 27 Aug 2011 17:11:19 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-44979</guid>
		<description>genial! muchísimas gracias!</description>
		<content:encoded><![CDATA[<p>genial! muchísimas gracias!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Federico</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-41145</link>
		<dc:creator>Federico</dc:creator>
		<pubDate>Sun, 17 Jul 2011 19:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-41145</guid>
		<description>Funciona de 10! gracias!</description>
		<content:encoded><![CDATA[<p>Funciona de 10! gracias!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: David</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-40876</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 13 Jul 2011 07:27:04 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-40876</guid>
		<description>perdonad soy nuevo ene sto de php y nose exactamente donde poner el código del que se está hablando, me dposeis hechar una mano? va dentro de body?</description>
		<content:encoded><![CDATA[<p>perdonad soy nuevo ene sto de php y nose exactamente donde poner el código del que se está hablando, me dposeis hechar una mano? va dentro de body?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Francisco</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-31633</link>
		<dc:creator>Francisco</dc:creator>
		<pubDate>Sun, 03 Apr 2011 07:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-31633</guid>
		<description>Esta muy bueno el script... es justo lo que necesito para realizar un proyecto para moviles....</description>
		<content:encoded><![CDATA[<p>Esta muy bueno el script&#8230; es justo lo que necesito para realizar un proyecto para moviles&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: 5tyytyytyyt</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-27212</link>
		<dc:creator>5tyytyytyyt</dc:creator>
		<pubDate>Sat, 19 Feb 2011 17:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-27212</guid>
		<description>&lt;a href=&quot;#comment-20908&quot; rel=&quot;nofollow&quot;&gt;@sebastian&lt;/a&gt;: 

&lt;a href=&quot;#comment-7174&quot; rel=&quot;nofollow&quot;&gt;@chema&lt;/a&gt;:</description>
		<content:encoded><![CDATA[<p><a href="#comment-20908" rel="nofollow">@sebastian</a>: </p>
<p><a href="#comment-7174" rel="nofollow">@chema</a>:</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Romeo-q</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-26633</link>
		<dc:creator>Romeo-q</dc:creator>
		<pubDate>Mon, 14 Feb 2011 16:58:58 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-26633</guid>
		<description>

¡¡NO A LA LEY SINDE !!</description>
		<content:encoded><![CDATA[<p>¡¡NO A LA LEY SINDE !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Luis Vásquez</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-24578</link>
		<dc:creator>Luis Vásquez</dc:creator>
		<pubDate>Wed, 19 Jan 2011 13:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-24578</guid>
		<description>Desafortunadamente este código no siempre funciona. 

El navegador estandard de BlackBerry viene configurado, de forma predeterminada, como Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1), por lo que este script no lo detecta como un movil.

Una posible solución es usando el valor de $_SERVER[&#039;HTTP_ACCEPT&#039;] que, en mi caso es:

application/vnd.rim.html,text/html,image/vnd.rim.png,image/jpeg,application/x-vnd.rim.pme.b,application/vnd.rim.ucs,image/gif;anim=1,application/vnd.rim.jscriptc;v=0-8-8,application/x-javascript,application/vnd.rim.css;v=1,text/css;media=screen,*/*;q=0.5

Donde puede detectarse la palabra rim (Research in motion) que es la fabricante de Blackberry.

No se si esto es la regla o la excepción, pues no he podido realizar pruebas con otros smartphones, como Nokia y IPhone.

Se podría mejorar la función con sólo concatenar las 2 variables de servidor y agregar &quot;.rim.&quot; a la cadena de búsqueda.


function isMobile(){
// Concateno las 2 variables de servidor.
$buscar_en = $_SERVER[&#039;HTTP_USER_AGENT&#039;] . $_SERVER[&#039;HTTP_ACCEPT&#039;];

return eregi( ‘ipod&#124;iphone&#124;android&#124;opera mini&#124;blackberry&#124;.rim.&#124;palm os&#124;windows ce’, $buscar_en);
}

Si el navegador es un móvil redigir a la url /m.php:

if( isMobile() ){
header( ‘location:/m.php’ );
exit();
}

Saludos,
Luis Vásquez</description>
		<content:encoded><![CDATA[<p>Desafortunadamente este código no siempre funciona. </p>
<p>El navegador estandard de BlackBerry viene configurado, de forma predeterminada, como Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1), por lo que este script no lo detecta como un movil.</p>
<p>Una posible solución es usando el valor de $_SERVER['HTTP_ACCEPT'] que, en mi caso es:</p>
<p>application/vnd.rim.html,text/html,image/vnd.rim.png,image/jpeg,application/x-vnd.rim.pme.b,application/vnd.rim.ucs,image/gif;anim=1,application/vnd.rim.jscriptc;v=0-8-8,application/x-javascript,application/vnd.rim.css;v=1,text/css;media=screen,*/*;q=0.5</p>
<p>Donde puede detectarse la palabra rim (Research in motion) que es la fabricante de Blackberry.</p>
<p>No se si esto es la regla o la excepción, pues no he podido realizar pruebas con otros smartphones, como Nokia y IPhone.</p>
<p>Se podría mejorar la función con sólo concatenar las 2 variables de servidor y agregar &#8220;.rim.&#8221; a la cadena de búsqueda.</p>
<p>function isMobile(){<br />
// Concateno las 2 variables de servidor.<br />
$buscar_en = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT'];</p>
<p>return eregi( ‘ipod|iphone|android|opera mini|blackberry|.rim.|palm os|windows ce’, $buscar_en);<br />
}</p>
<p>Si el navegador es un móvil redigir a la url /m.php:</p>
<p>if( isMobile() ){<br />
header( ‘location:/m.php’ );<br />
exit();<br />
}</p>
<p>Saludos,<br />
Luis Vásquez</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: sebastian</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-20908</link>
		<dc:creator>sebastian</dc:creator>
		<pubDate>Tue, 07 Dec 2010 03:39:19 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-20908</guid>
		<description>buenisimo, muy sencillo, SE entiende perfecto, luego q digan lo q quieran, q no sean mala onda. Se entiende de 10 si sabes 2% de php</description>
		<content:encoded><![CDATA[<p>buenisimo, muy sencillo, SE entiende perfecto, luego q digan lo q quieran, q no sean mala onda. Se entiende de 10 si sabes 2% de php</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Anónimo</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-16953</link>
		<dc:creator>Anónimo</dc:creator>
		<pubDate>Thu, 21 Oct 2010 14:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-16953</guid>
		<description>Gracias por responder! Entonces cómo serían las etiquetas de apertura y cierre correctas?
Por las dudas te dejo el código para poder postear esos códigos sin que te lo tome como código directo:

? = &#063;
 = &gt;
$ = &#036;</description>
		<content:encoded><![CDATA[<p>Gracias por responder! Entonces cómo serían las etiquetas de apertura y cierre correctas?<br />
Por las dudas te dejo el código para poder postear esos códigos sin que te lo tome como código directo:</p>
<p>? = &#63;<br />
 = &#62;<br />
$ = &#36;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Gabriel</title>
		<link>http://miquelcamps.com/php/funcion-php-para-detectar-un-movil-y-redirigir/comment-page-1/#comment-14900</link>
		<dc:creator>Gabriel</dc:creator>
		<pubDate>Wed, 08 Sep 2010 02:19:59 +0000</pubDate>
		<guid isPermaLink="false">http://miquelcamps.com/?p=1237#comment-14900</guid>
		<description>Jonee:

El ejemplo de código que puse no apareció en mi comentario anterior por los caracteres de inicio y final de código PHP. Lo repito omitiendo los caracteres especiales:

[inicio PHP. es el caracter &#039;menor que&#039; y un &#039;?&#039;]

function isMobile(){
return eregi( ‘ipod&#124;iphone&#124;android&#124;opera mini&#124;blackberry&#124;palm os&#124;windows ce’, $_SERVER[&#039;HTTP_USER_AGENT&#039;] );
}

if( isMobile() ){
   header( &#039;m/index.html&#039; );  // sitio para móvil
}
else {
   header( &#039;index.html&#039; );  // sitio normal
}

[fin PHP. es el caracter &#039;?&#039; y &#039;mayor que&#039;]</description>
		<content:encoded><![CDATA[<p>Jonee:</p>
<p>El ejemplo de código que puse no apareció en mi comentario anterior por los caracteres de inicio y final de código PHP. Lo repito omitiendo los caracteres especiales:</p>
<p>[inicio PHP. es el caracter 'menor que' y un '?']</p>
<p>function isMobile(){<br />
return eregi( ‘ipod|iphone|android|opera mini|blackberry|palm os|windows ce’, $_SERVER['HTTP_USER_AGENT'] );<br />
}</p>
<p>if( isMobile() ){<br />
   header( &#8216;m/index.html&#8217; );  // sitio para móvil<br />
}<br />
else {<br />
   header( &#8216;index.html&#8217; );  // sitio normal<br />
}</p>
<p>[fin PHP. es el caracter '?' y 'mayor que']</p>
]]></content:encoded>
	</item>
</channel>
</rss>

