<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webdriver &#187; php</title>
	<atom:link href="http://www.webdriver.com.ar/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdriver.com.ar</link>
	<description>When play is part of the job</description>
	<lastBuildDate>Tue, 17 Aug 2010 19:15:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MiniTip: PHP Show Errors</title>
		<link>http://www.webdriver.com.ar/minitip-php-show-all-errors/</link>
		<comments>http://www.webdriver.com.ar/minitip-php-show-all-errors/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:32:02 +0000</pubDate>
		<dc:creator>Miguel Angel</dc:creator>
				<category><![CDATA[programación]]></category>
		<category><![CDATA[consejo]]></category>
		<category><![CDATA[errores]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.webdriver.com.ar/?p=495</guid>
		<description><![CDATA[No es el tip que va a cambiar el mundo, pero siempre que lo necesito tengo que buscarlo por google, son dos simples lineas que activa el reporte de error de PHP donde el php.ini lo deshabilita por defecto. A veces cuando testeamos un PHP con errores, simplemente muestra la pagina en blanco, esta es [...]]]></description>
			<content:encoded><![CDATA[<p>No es el tip que va a cambiar el mundo, pero siempre que lo necesito tengo que buscarlo por google, son dos simples lineas que activa el reporte de error de PHP donde el php.ini lo deshabilita por defecto.</p>
<p>A veces cuando testeamos un PHP con errores, simplemente muestra la pagina en blanco, esta es una señal de que está desactivado el reporte de errores.</p>
<h3>Ejemplo</h3>
<p>Mostrar todos los errores.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
&nbsp;
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Otras opciones</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Turn off all error reporting</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Report simple running errors</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ERROR</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_WARNING</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_PARSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Reporting E_NOTICE can be good too (to report uninitialized</span>
<span style="color: #666666; font-style: italic;">// variables or catch variable name misspellings ...)</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ERROR</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_WARNING</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_PARSE</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_NOTICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Report all errors except E_NOTICE</span>
<span style="color: #666666; font-style: italic;">// This is the default value set in php.ini</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Report all PHP errors (see changelog)</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Report all PHP errors</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Same as error_reporting(E_ALL);</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>Referencia</h3>
<p>Mas data en la pagina de PHP</p>
<p><a title="PHP: error_reporting" href="http://ar2.php.net/manual/en/function.error-reporting.php" target="_blank">http://ar2.php.net/manual/en/function.error-reporting.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdriver.com.ar/minitip-php-show-all-errors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Enviar Email con adjunto en PHP</title>
		<link>http://www.webdriver.com.ar/enviar-email-con-adjunto-en-php/</link>
		<comments>http://www.webdriver.com.ar/enviar-email-con-adjunto-en-php/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 01:25:19 +0000</pubDate>
		<dc:creator>Miguel Angel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[adjunto]]></category>
		<category><![CDATA[attach]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[ejemplo]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[geekology]]></category>
		<category><![CDATA[libreria]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.webdriver.com.ar/?p=476</guid>
		<description><![CDATA[En todo sistema la información de la base de datos es importante (sobre todo los backups), hace no mucho un cliente me pidió que el sistema que le habia programado (un concurso online) le envíe un backup de la base de datos en un ZIP por email, por un lado programé un CRON diario, este [...]]]></description>
			<content:encoded><![CDATA[<p>En todo sistema la información de la base de datos es importante (sobre todo los backups), hace no mucho un cliente me pidió que el sistema que le habia programado (un concurso online) le envíe un backup de la base de datos en un ZIP por email, por un lado programé un CRON diario, este CRON ejecuta un PHP que genera los inserts y finalmente con una linea de comando armo el ZIP, hasta ahi todo bien, solo quedaba mandar el email con el zip. Hace tiempo que uso la función mail de PHP pero no tiene la opción de adjuntar archivos, asi que gracias al amigo google, encontré una clase muy buena y sencilla de usar que te permite hacerlo muy facil.</p>
<h3>Librerias</h3>
<p>Es simplemente una clase que se puede <a title="Clase GeekMail" href="http://www.geekology.co.za/download/geekMail-1.0-php.zip">descargar desde Geekology</a></p>
<h3>Ejemplo</h3>
<p>Ejemplo básico para enviar un email HTML con un ZIP adjunto.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require</span> <span style="color: #0000ff;">'geekMail-1.0.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$geekMail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> geekMail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMailType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'html'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'from_mail@host.com'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'FromName'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">to</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'destiny_mail@host.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">subject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email Subject'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'This is an &lt;strong&gt;example&lt;/strong&gt; message.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attach</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'myfile.zip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$geekMail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDebugger</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Importante!</h3>
<p>Si van a adjuntar un ZIP tengan cuidado con el contenido, en mi caso quería adjuntar un ZIP con un archivo .SQL y ciertos clientes (como Hotmail y el cliente de email de MAC) toma como preligroso ese tipo de archivos y les borra el contenido dejando el ZIP en 0KB.</p>
<p>Si tienen el mismo problema la solucion mas sencilla fué ponerle contraseña al ZIP, esto evita que el antivirus pueda escanearlo y lo deja intacto.</p>
<h3>Referencia</h3>
<p>Mas información sobre la clase.</p>
<p><a title="Geekology" href="http://www.geekology.co.za/blog/2009/11/simpler-way-to-send-text-html-emails-with-attachments-in-php/" target="_blank">http://www.geekology.co.za/blog/2009/11/simpler-way-to-send-text-html-emails-with-attachments-in-php/</a></p>
<p>Ustedes tienen alguna otra clase que haga algo similar, pero mejor?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdriver.com.ar/enviar-email-con-adjunto-en-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiples inserts en SQL</title>
		<link>http://www.webdriver.com.ar/multiples-inserts-en-sql/</link>
		<comments>http://www.webdriver.com.ar/multiples-inserts-en-sql/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 20:58:21 +0000</pubDate>
		<dc:creator>Miguel Angel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snnipets]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.webdriver.com.ar/w/es/blog/?p=183</guid>
		<description><![CDATA[Este es el tipo de TIPS que uno no conoce hasta que decide optimizar el codigo: Como hacer multiples inserts en una única consulta en SQL INSERT INTO  alumnos (nombre, edad) VALUES ('Mike', 27), ('Adams', 25), ('Charlie', 29)]]></description>
			<content:encoded><![CDATA[<p>Este es el tipo de TIPS que uno no conoce hasta que decide optimizar el codigo:</p>
<p>Como hacer multiples inserts en una única consulta en SQL</p>
<pre><code>INSERT INTO 
   alumnos (nombre, edad)
VALUES
   ('Mike', 27),
   ('Adams', 25),
   ('Charlie', 29)</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webdriver.com.ar/multiples-inserts-en-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
