<?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>El Blog del Antonio &#187; PHP</title>
	<atom:link href="http://www.ramirezcobos.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ramirezcobos.com</link>
	<description>Programming Web with PHP, CSS, Javascript and ∞</description>
	<lastBuildDate>Wed, 14 Jul 2010 14:03:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PalmStudios Model Agency</title>
		<link>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/</link>
		<comments>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 14:03:03 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Jobs]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=489</guid>
		<description><![CDATA[Hi there, I would like to introduce you my last web project: http://www.palmstudios.com For this project I have developed a sort of MVC (Model View Controller) over the RedBeanPHP DB library (PHP 5.3.2).  This project even though it looks quite simple it has a very power CMS (Content Management System) on its backend that allows]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-490" href="http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-00/"><img class="alignright size-medium wp-image-490" title="Captura de pantalla 2010-07-12 a las 16.03.00" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.00-300x248.png" alt="" width="300" height="248" /></a>Hi there,</p>
<p>I would like to introduce you my last web project: <a title="Palmstudios Model Agency" href="http://www.palmstudios.com" target="_blank">http://www.palmstudios.com</a></p>
<p>For this project I have developed a sort of MVC (Model View Controller) over the <a title="RedBean PHP" href="http://www.redbeanphp.com" target="_blank">RedBeanPHP</a> DB library (PHP 5.3.2).  This project even though it looks quite simple it has a very power CMS (Content Management System) on its backend that allows the model agency to control most of the aspects of its business:</p>
<ol>
<li>- Clients Management</li>
<li>- Models Management (Men, Women, Children &amp; Extras) -contact details, measurements, pictures, and so on&#8230;</li>
<li>- Promotional Packages Management &#8211; this is a special addon which allows the agency to create model promotional bundles to send to its clients</li>
</ol>
<p>There is a ton of client and server libraries that this application makes use of, such as:</p>
<ul>
<li>JQuery FancyBox</li>
<li>JQuery Livequery</li>
<li>JQuery AjaxQ</li>
<li>PHPMailer</li>
<li>RedBeanPHP</li>
<li>Savant3 Template Engine</li>
<li>PHPThumb</li>
<li>TinyMCE</li>
</ul>
<p>The CMS has a configuration section where site administrator can configure:</p>
<ul>
<li>Web site languages (has multiple language support)</li>
<li>Web site translations (you can even ask GOOGLE about a translation depending of the languages installed on the system)</li>
<li>Model properties (size, height, waist, etc&#8230;)</li>
<li>Hair Colors</li>
<li>Eye Colors</li>
<li>Users</li>
</ul>
<p>Here is a snapshot gallery of the Site and its CMS</p>

<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-00/' title='Captura de pantalla 2010-07-12 a las 16.03.00'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.00-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.00" title="Captura de pantalla 2010-07-12 a las 16.03.00" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-07-44/' title='Captura de pantalla 2010-07-12 a las 16.07.44'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.07.44-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.07.44" title="Captura de pantalla 2010-07-12 a las 16.07.44" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-08-21/' title='Captura de pantalla 2010-07-12 a las 16.08.21'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.08.21-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.08.21" title="Captura de pantalla 2010-07-12 a las 16.08.21" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-09-01/' title='Captura de pantalla 2010-07-12 a las 16.09.01'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.09.01-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.09.01" title="Captura de pantalla 2010-07-12 a las 16.09.01" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-09-27/' title='Captura de pantalla 2010-07-12 a las 16.09.27'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.09.27-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.09.27" title="Captura de pantalla 2010-07-12 a las 16.09.27" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-31/' title='Captura de pantalla 2010-07-12 a las 16.03.31'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.31-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.31" title="Captura de pantalla 2010-07-12 a las 16.03.31" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-53/' title='Captura de pantalla 2010-07-12 a las 16.03.53'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.53-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.53" title="Captura de pantalla 2010-07-12 a las 16.03.53" /></a>

<h2>I am open for Freelance Jobs</h2>
<p>If any of you would like to create a model agency application like this, let me know, I will be more than happy to collaborate with you on it. I will also sell the source code of its panel for any of you who is interested.</p>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yii Framework -Final Decision</title>
		<link>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/</link>
		<comments>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 18:43:51 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Frameowrk]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=481</guid>
		<description><![CDATA[I never felt comfortable with external libraries, those created by other people. Always, since my old times with Visual Basic, have created my own and until now, everything I created was good enough but&#8230; Suddenly, after I found that marvellous library called RedBean, I found my self re-programming all my libraries and end up creating]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-483" href="http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/yii_logo-300x300/"><img class="alignright size-full wp-image-483" title="Yii Framework" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/yii_logo-300x300.jpg" alt="" width="300" height="300" /></a>I never felt comfortable with external libraries, those created by other people. Always, since my old times with Visual Basic, have created my own and until now, everything I created was good enough but&#8230; Suddenly, after I found that marvellous library called <a href="http://www.redbeanphp.com" target="_blank">RedBean</a>, I found my self re-programming all my libraries and end up creating a controller and a base model class for a sort of MVC library &#8211; I will post it one of these days so you guys can look at it and find out how easy is to implement that incredible library is (thanks Gabor de Mooij!) on your libraries.</p>
<p>But, as a programmer, I started to think that, even though my own libraries speed up my development processes, I want it to be hands on a bigger and more ambitious projects -that happened long time a go but never felt impressed by any library out there. My libraries lacked on scalable development architecture and had to find for a better solution for a much bigger project I am jumping right now. I google around and found interesting offers as exposed on <a href="http://www.ramirezcobos.com/2010/01/26/php-frameworks/" target="_blank">one of my old posts</a>:</p>
<ul>
<li><a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a></li>
<li><a href="http://www.yiiframework.com/">Yii</a></li>
<li><a href="http://www.cakephp.org" target="_blank">CakePHP</a></li>
<li><a href="http://framework.zend.com/home" target="_blank">Zend</a></li>
<li><a href="http://www.symfony-project.com/" target="_blank">Symfony</a></li>
<li><a href="http://www.phpdevshell.org/" target="_blank">PHPDevShell</a></li>
<li><a href="http://www.pradosoft.com/" target="_blank">Prado</a></li>
<li><a href="http://www.akelos.org/" target="_blank">Akelos</a></li>
<li><a href="http://www.akelos.org/" target="_blank">ZooP</a></li>
<li><a href="http://qphp.net/" target="_blank">QPHP</a></li>
<li><a href="http://www.ez.no/ezcomponents" target="_blank">ezComponents</a></li>
<li><a href="http://www.doophp.com/" target="_blank">DooPHP</a></li>
</ul>
<p>Actually, far too many, so I took my time to decide for one to suit all my needs. Checked around and read some good articles about Yii framework and then, telling the truth, I was very impressed with (information taken from <a href="http://programmersnotes.info/2009/02/24/yii_framework_of_my_choice/" target="_self">http://programmersnotes.info</a>:</p>
<ul>
<li>100% OO architecture. It is really good application design.</li>
<li>Authentication &amp; roles mechanism</li>
<li>Caching techniques</li>
<li>DB access, which is based on PDO</li>
<li>Active record and relational active record implementation</li>
<li>Validation – that is really, really nice. To create quite complex  register form (check if login is unique, if email is unique, email match  with confirmation, passwords match, validate integer/string values,  check empty fields and give nice error messages for each field you need  only template (view) and model with rules defined. It took me 10-15 mins  to do that!)</li>
<li>Component concept. Just to give an idea, why is it nice – you can  define getter and setter methods for properties, you can define  read-only properties for components, define and invoke events, attach  event handlers and additional features to the class without modifying  it, just by attaching additional behaviour to it</li>
<li>Also, check its graphical benchmarking against other MVC frameworks <a href="http://www.yiiframework.com/performance" target="_blank">http://www.yiiframework.com/performance</a>.</li>
</ul>
<p>Wondering whether <a href="http://www.doophp.com">DooPHP</a> (claiming is the fastest at the moment) or <a href="http://www.yiiframework.com/" target="_blank">Yii</a>, I finally decided to use the latest due that DooPHP is quite new and Yii has a huge amount of features and tweaks that, even its documentation is not the best (I just read their Definitive Guide and I think I will have to read to a couple of hundreds articles more to be &#8216;good&#8217; at it), I think at the end will become the Toolset for highly scalable projects -using its automation tool called <a href="http://www.yiiframework.com/doc/guide/topics.gii" target="_blank">Gii</a>, I did the skeleton of a project in less than 30 seconds -duh!.</p>
<p>In addition. last but not least, you can integrate <a href="http://framework.zend.com/manual/components">Zend components</a> easily and <a href="http://www.jquery.com" target="_blank">jQuery</a> is nativelly implemented -and I loooooove jQuery.</p>
<p>For the small ones I still like my own libraries though <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uri Class for PHP</title>
		<link>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/</link>
		<comments>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 07:38:15 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=466</guid>
		<description><![CDATA[For years, we developers tend to keep functions that we find useful into our projects, after certain time they become obsolete or you move one to higher level ways of programming. Some of us, can&#8217;t get rid of the code that was once collected-created and I thought let&#8217;s see if I post one of my]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a rel="attachment wp-att-467" href="http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/open-source/"><img class="alignright size-medium wp-image-467" title="open-source" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/open-source-300x258.png" alt="" width="300" height="258" /></a>For years, we developers tend to keep functions that we find useful into our projects, after certain time they become obsolete or you move one to higher level ways of programming. Some of us, can&#8217;t get rid of the code that was once collected-created and I thought let&#8217;s see if I post one of my silly old classes what can we get out of it? Let&#8217;s make it open source hahahaha.</p>
<p style="text-align: justify;">I propose you the following: Here is my small old good set of Uri PHP functions encapsulated into one class, I know is not a great deal but, let&#8217;s see what can we all do with it. For every programmer that posts a function, I will write his reference into the class and post his/her site link in this post.</p>
<p style="text-align: justify;">There are certain rules though:</p>
<ol style="text-align: justify;">
<li>Functions cannot be greater than 20 lines of code</li>
<li>Functions cannot depend of far too many external components (maximum one)</li>
<li>If functions depend of an external component/class, a URL indicating its reference must be provided</li>
<li>Functions are not to be repetitive, if there is one better written that the ones exposes we will replace it</li>
</ol>
<h3 style="text-align: justify;">The Uri Class</h3>
<p style="text-align: justify;">Here is my class:</p>
<p style="text-align: justify;">
<pre class="brush: php;">
&lt;?php
/**
 * @author Antonio Ramirez &lt;contactme@atmyblog.com&gt;
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link http://www.ramirezcobos.com/
 *
 *
 */
class Uri
{
	/**
	 * Encodes the parameter to hide
	 * its contents to user
	 *
	 * @param string $val
	 */
	function uriEncode($val)
	{
		return rawurlencode(base64_encode($val));
	}
	/**
	 * Decodes a parameter string that
	 * was previously encoded with uriEncode
	 * function
	 *
	 * @param string $val
	 */
	function uriDecode($val){
		return base64_decode(rawurldecode($val));
	}
	/**
	 * Translates a given url to
	 * tinyurl version -curl required
	 *
	 * @param string $url
	 * @access public
	 * @return string $data
	 */
	function getTinyUrl($url){
		$ch = curl_init();
		$timeout = 5;
		curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
		$data = curl_exec($ch);
		curl_close($ch);
		return $data;
	}
	/**
	 * Translates a given url to
	 * ToLyUrl version -curl required
	 *
	 * @param string $url
	 * @access public
	 * @return string $data
	 */
	function getToLyUrl($url){
		$ch = curl_init();

		curl_setopt($ch, CURLOPT_URL, 'http://to.ly/api.php?longurl='.urlencode($url));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_HEADER, 0);

		$data = curl_exec ($ch);
		curl_close ($ch);

		return $data;
	}
	/**
     * Gets Request param
     *
     * @param string $paramName
     * @param string $slash
     * @access public
     * @return string $param or boolean $false
     */
	function getParam($paramName, $slash=false)
	{
		return (isset($_REQUEST[$paramName])?($slash?addslashes($_REQUEST[$paramName]):$_REQUEST[$paramName]):false);
	}
	/**
     * Serializes Request params
     *
     * @param string $notThisOne
     * @access public
     * @return string $query_string
     */
	function getParams($notThisOne=false)
  	{
		global $REQUEST_METHOD, $HTTP_GET_VARS, $HTTP_POST_VARS;
		$query_string='';
		if (strpos($_SERVER['REQUEST_URI'],&quot;?&quot;))
		{
			list($fullfile, $voided) = explode(&quot;?&quot;, $_SERVER['REQUEST_URI']);
			$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $HTTP_GET_VARS : $HTTP_POST_VARS;
			reset ($cgi);
			while (list($key, $value) = each($cgi)) {
			  if ($key != $notThisOne)
				$query_string .= &quot;&amp;&quot; . $key . &quot;=&quot; . $value;
			}
		}
		return $query_string;
  	}
	/**
     * Makes a Soap Call
     *
     * @param string $uri
     * @param string $command
     * @param string $xml
     * @access public
     * @return string $response
     *
     * Requires Soap
     */
	function makeSoapCall($uri,$command,$xml)
	{

		try{

			ini_set('default_socket_timeout',10); // ten seconds, that is all we wait

			$client = new SoapClient($uri,array(&quot;connection_timeout&quot;=&gt;10));

			$response =  $client-&gt;__soapCall($command,array(new SoapParam($xml,'Peticion')));
		}
		catch(Exception $e){

			$response = false;
		}
		return $response;
	}
	/**
	 * Parses a given $url for validation
	 *
	 * @param string $url
	 * @access public
	 * @return $parsed_url
	 */
	function getParsedUrl($url)
	{
		$parsed_url = parse_url($url);

		if (!isset($parsed_url['scheme']) or $parsed_url['scheme'] != 'http'){
			echo 'Unsupported URL sheme given, please just use &quot;HTTP&quot;.';
			exit();
		}
		if (!isset($parsed_url['host']) or $parsed_url['host'] == ''){
			echo 'Invalid URL given!';
			exit();
		}

		$host = $parsed_url['host'];
		$host .= (isset($parsed_url['port']) and  !empty($parsed_url['port'])) ? ':'.$parsed_url['port'] : '';
		$path = (isset($parsed_url['path']) and  !empty($parsed_url['path'])) ? $parsed_url['path'] : '/';
		$path .= (isset($parsed_url['query']) and  !empty($parsed_url['query'])) ? '?'.$parsed_url['query'] : '';

		return 'http://' . $host . $path;
	}
	/**
     * Requests a Url and returns its contents
     *
     * @param string $url
     * @access public
     * @return string $query_string
     * @uses Snoopy class http://sourceforge.net/projects/snoopy/
     */
	function getUrlContent($url)
	{
		App::import('component','snoopy');

		$url = Uri::getParsedUrl($url);

		$snoopy = new Snoopy();
		$snoopy-&gt;agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; es-ES; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12';
		$snoopy-&gt;referer = '';

		$results = false;

		if($snoopy-&gt;fetch($url)){

			$results = $snoopy-&gt;results;
			// empty buffer:
			$snoopy-&gt;results = '';
		}

		return $results;
	}
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RedBean ORM</title>
		<link>http://www.ramirezcobos.com/2010/06/07/redbean-orm/</link>
		<comments>http://www.ramirezcobos.com/2010/06/07/redbean-orm/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 09:34:21 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=457</guid>
		<description><![CDATA[I was breaking my head towards to find a better ORM approach for my own written framework. I used, and was very happy with P.O.R.K., for quite long time but, as most of us, I was looking for something that could improve the speed of my projects. P.O.R.K. configuration is not hard at all, it]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-458" href="http://www.ramirezcobos.com/2010/06/07/redbean-orm/redb/"><img class="alignright size-medium wp-image-458" title="redB" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/redB-300x180.jpg" alt="" width="300" height="180" /></a>I was breaking my head towards to find a better <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">ORM</a> approach for my own written framework. I used, and was very happy with <a href="http://www.schizofreend.nl/Pork.dbObject" target="_blank">P.O.R.K.</a>, for quite long time but, as most of us, I was looking for something that could improve the speed of my projects. <a href="http://www.schizofreend.nl/Pork.dbObject" target="_blank">P.O.R.K.</a> configuration is not hard at all, it is compound of a set of classes encapsulated in three files that allowed me to create <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">models</a> in sort of ActiveRecord style and was really, really good when I first started.</p>
<p>Now my projects are bigger, require a lot more of database analysis and those sometimes go up to 30 tables or more. That means that once analysed a project, I had to create those tables in the database, specify their fields and so on&#8230; you know.</p>
<p>I found my self into the lazyness mode and I was already thinking that it could be great to create a set of libraries that do not require any configuration files at all and could manipulate my databases in such a way that not only queries for data but also dynamically creates the tables for me if they do not exists. That could save me around one or two days of work I thought&#8230;</p>
<p>Before creating anything I ask mr &#8216;Google&#8217; if there was something around that could match my concept (never reinvent the wheel) and OH MY&#8230; I found it, its name is <a href="http://redbeanphp.com/" target="_blank">RedBean</a> and I have to say that is one of the greatest libraries that have ever came across.</p>
<p><strong>How it works</strong></p>
<p>Create a database</p>
<p>Include the required files to work with RedBean -one file: redbean.inc.php</p>
<pre class="brush: php;">

include('mypathto/redbean.inc.php&quot;);
</pre>
<p>Access its core:</p>
<pre class="brush: php;">
//Assemble a database connection string (DSN)
$dsn = &quot;mysql:host=localhost;dbname=mydatabasename&quot;;

//Connect to database and fetch the toolbox; either with password
$toolbox = RedBean_Setup::kickstartDev($dsn, $username, $password);
</pre>
<p>Now, just for this example: creating one Bean</p>
<pre class="brush: php;">

$rb = $toolbox-&gt;getRedBean();

// lets create one object that we didnt even declared anywhere <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
$post = $rb-&gt;dispense('post');

// set some variables -fields
$post-&gt;title = 'This is magic';
$post-&gt;created = date('Y-m-d');

// save newly created object to database (how come?)
$rb-&gt;store($post);
</pre>
<p>If we were to look onto our database, we will find now that a new table is created called &#8216;post&#8217; and your bean has successfully saved its properties.</p>
<p>Of course, this is a silly example, in my case I am using redbean on a MVC &#8216;modified&#8217; pattern (I don&#8217;t like the &#8216;View&#8217; part as it is implemented in modern frameworks and for small projects I use my own approach). Please, have a look to its manual, trust me, it is <a href="http://redbeanphp.com/#/beans" target="_blank">worth</a> a try.</p>
<p>From the deep of my heart, THANKS for such a great job to his developer mr (Gabor) de Mooij. At last, one EASY yet POWERFULL library for our projects that really help us saving developing time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/07/redbean-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Torrenova Rentacar</title>
		<link>http://www.ramirezcobos.com/2010/03/31/torrenova-rentacar/</link>
		<comments>http://www.ramirezcobos.com/2010/03/31/torrenova-rentacar/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 09:32:14 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jobs]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=408</guid>
		<description><![CDATA[I would like to show you one of the reasons of why I have been so busy lately: torrenovarentacar.com. One of the most complete sites in terms of rentacar systems. Fully synchronized with one of the most used rent a car management programs in Spain, CarPlus (www.cargestion.es) and with a highly powerful control panel where]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-5.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-5-300x274.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-5-300x274.png"></a><strong><span style="font-weight: normal;"> </span></strong></p>
<div id="attachment_410" class="wp-caption alignright" style="width: 310px"><a rel="attachment wp-att-410" href="http://www.ramirezcobos.com/2010/03/31/torrenova-rentacar/picture-1-5/"><img class="size-medium wp-image-410" title="Torrenova Rentacar" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-11-300x165.png" alt="Torrenova Rentacar" width="300" height="165" /></a><p class="wp-caption-text">Torrenova Rentacar</p></div>
<p><em>I would like to show you one of the reasons of why I have been so busy lately: <a href="http://www.torrenovarentacar.com" target="_blank">torrenovarentacar.com</a>. </em></p>
<p>One of the most complete sites in terms of rentacar systems. Fully synchronized with one of the most used rent a car management programs in Spain, CarPlus (www.cargestion.es) and with a highly powerful control panel where the rent a car owner controls absolutely everything. Its web panel features:</p>
<ul>
<li>Company details</li>
<li>Contacts</li>
<li>Offices and their Google locations</li>
<li>CarPlus Settings and Sync</li>
<li>Users</li>
<li>Extras</li>
<li>Cars</li>
<li>Car Groups</li>
<li>Car Models</li>
<li>Translations (It can set new languages at will)</li>
</ul>
<p>If you have time, please check it out as I would love to get some feedback about it.<br />
Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/03/31/torrenova-rentacar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hip Hop for PHP?</title>
		<link>http://www.ramirezcobos.com/2010/02/03/hip-hop/</link>
		<comments>http://www.ramirezcobos.com/2010/02/03/hip-hop/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 16:04:50 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=270</guid>
		<description><![CDATA[Guys, it seems that the days of breaking your head towards how to protect your PHP code is about to end. Following a great article from the Web explaining what happens nowadays with PHP Hip Hop Facebook&#8217;s approach. The open source dynamic scripting language PHP is widely deployed across the Web, powering countless Web sites]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-1.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-1-300x201.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-1-300x201.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-1.png"><img class="alignright size-medium wp-image-379" title="Imagen-1" src="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-1-300x201.png" alt="" width="300" height="201" /></a>Guys, it seems that the days of breaking your head towards how to protect your PHP code is about to end. Following a great article from the Web explaining what happens nowadays with PHP Hip Hop Facebook&#8217;s approach.</p>
<p>The open source dynamic scripting language PHP is widely deployed across the Web, powering countless Web sites (including the Internet.com network). Now Facebook is aiming to change the game with today&#8217;s release of a major new PHP effort called HipHop.</p>
<p>With HipHop, Facebook is providing a new runtime that is intended to improve PHP use in large-scale deployments. The HipHop effort, which also includes a new Web server, has already been in use by Facebook for the past six months, though the project is just being made public today.</p>
<p>Facebook developers say the HipHop effort isn&#8217;t an attempt to fork the PHP community, but rather, a move to help PHP scale.</p>
<p>&#8220;There are two different pieces to keep in mind, one is the PHP language itself, then there is the runtime that actually goes and interprets the language and runs it,&#8221; David Recordon, Facebook&#8217;s senior open programs manager, told <em>InternetNews.com</em>. &#8220;What we&#8217;ve done is we&#8217;ve implemented the PHP 5.2 language with a few features removed. Our plan is to keep the language the same, but what we&#8217;ve changed is the underlying runtime and the process of going and transforming the source code into C++ and then compiling it and pushing out the compiled binary.&#8221;</p>
<p><script type="text/javascript">// <![CDATA[
 			initArticleMenu(document.getElementById("toolBoxShareMenu"));
// ]]&gt;</script>Facebook said the results of using HipHop have been dramatic. CPU usage on Facebook servers has dropped by an average of 50 percent as the HipHop PHP engine reduced the load on Facebook&#8217;s infrastructure.</p>
<p>The results have proven to be compelling enough that Facebook now uses HipHop to deliver more than 90 percent of its production server traffic.</p>
<p>HipHop isn&#8217;t just a new code transformation tool, either. The overall effort also includes a new Web server to deploy PHP as well. Typically, in open source deployments, PHP is served with Apache Web servers.</p>
<p>&#8220;In general, Apache is a great Web server, but when we were looking at how we get the next half percent or percent of performance, we didn&#8217;t need all the features that Apache offers,&#8221; Recordon said. He added, however, that he hopes an open source project will one day emerge around making HipHop work with Apache Web servers.</p>
<p>The idea of optimizing the PHP runtime is not a new one, with multiple solutions in the market today including eAccelerator and <a href="http://www.internetnews.com/dev-news/article.php/3814126">commercial PHP products from Zend</a>. Zend is one of the lead commercial sponsors behind PHP.</p>
<p>&#8220;HipHop looks like an interesting project,&#8221; Zend CEO Andi Gutmans told <em>InternetNews.com</em>. &#8220;We have been briefed by Facebook but will certainly take a closer look now. There have been other such projects but most have been targeting managed runtimes such as Java and .NET with various degrees of success. We welcome any innovation that will help PHP extend its leadership position in Web application development.&#8221;</p>
<p>Gutmans added that, as is the case with all runtimes, it is important to continue innovating and the PHP runtime has continued to evolve over the years.</p>
<p>&#8220;I think it is important to continue to fold in new ideas and innovations into the community-based runtime and it&#8217;ll be interesting to learn what HipHop concepts could be relevant to the existing PHP community,&#8221; Gutmans said.</p>
<p>With some PHP runtime optimization solutions, the optimization is often a simple matter of a module load and a line change in the php.ini configuration file.</p>
<p>It&#8217;s not quite that easy with HipHop.</p>
<p>&#8220;This is not an extension to PHP &#8212; this is pretty different,&#8221; Recordon said. &#8220;Right now, the process is once you build and compile HipHop, it comes with a tool that will go through the transformation process and output the binary, and that&#8217;s what you actually use to run it.&#8221;</p>
<p>With HipHop, Facebook said its aim is not to split the PHP community but rather to help grow it. According to Recordon, HipHop will help to solidify PHP&#8217;s position as a great language for doing Web site development.</p>
<p>&#8220;There is definitely the piece in there that HipHop is designed for larger PHP deployments and not necessarily for individuals hosting their own blog or small Web site,&#8221; Recordon said. &#8220;The proof of the effect of HipHop will be over the next year as we start to make deployment tools easier, and as we start to build a successful community around it and start working with others on its future development and solving problems for companies beyond just Facebook.&#8221;<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/02/03/hip-hop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling Timeouts with PHP5 SoapClient Extension</title>
		<link>http://www.ramirezcobos.com/2010/02/02/handling-timeouts-with-php5-soapclient-extension/</link>
		<comments>http://www.ramirezcobos.com/2010/02/02/handling-timeouts-with-php5-soapclient-extension/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 01:37:10 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=266</guid>
		<description><![CDATA[I was breaking my head towards a silly thing around SoapClient Calls. My actual project requires Soap Calls to certain providers and everytime I was calling the external server, I had to wait for the server response (if any) and if the server failed to respond accordingly&#8230; damn&#8230; Warnings and/or Errors displayed and boom&#8230; My]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-2.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-2-300x197.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-2-300x197.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-2-300x197.png"><img class="alignright size-full wp-image-387" title="Imagen-2-300x197" src="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-2-300x197.png" alt="" width="300" height="197" /></a>I was breaking my head towards a silly thing around SoapClient Calls. My actual project requires Soap Calls to certain providers and everytime I was calling the external server, I had to wait for the server response (if any) and if the server failed to respond accordingly&#8230; damn&#8230; Warnings and/or Errors displayed and boom&#8230; My great application just looked like&#8230; well, forget it, I just used the try and catch statements for that&#8230; not big deal.</p>
<p>So I jump over Google&#8217;s horse and looked around implementing timeouts! because that was a true issue. Can you imagine? A user makes a request I looked around my DB and suddenly that single SOAP call takes me one minute to respond. No good, time for a solution.</p>
<p>Found the way to do it, by setting a hidden parameter (not documented) named &#8216;connection_timeout&#8217;:</p>
<pre class="brush: php;">
//
// setting a connection timeout (five seconds on the example)
//
$client = new SoapClient($wsdl, array(&quot;connection_timeout&quot;=&gt;15));
</pre>
<p>The above says wait 15 seconds before returning a fault if you cannot connect properly to the host. The parameter &#8216;connection_timeout&#8217; addresses the time it takes to wait to connect to your host.</p>
<p>As Jim Plush&#8217;s said:</p>
<blockquote><p>You&#8217;d have two timeouts set in your application one for how long it should take to actually connect to your remote host and a timeout for how long the socket connection should wait for a response from the server.</p></blockquote>
<p>So, now we need to set the time we wait for a server response with the following:</p>
<pre class="brush: php;">

ini_set('default_socket_timeout', 180);
</pre>
<p>With these two configuration options we control the time to wait for a Soap host connection and the time waiting for a Soap Service response. Just perfect.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<a href='http://www.ramirezcobos.com/2010/02/02/handling-timeouts-with-php5-soapclient-extension/imagen-2-300x197-2/' title='Imagen-2-300x197'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-2-300x197-120x120.png" class="attachment-thumbnail" alt="Imagen-2-300x197" title="Imagen-2-300x197" /></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/02/02/handling-timeouts-with-php5-soapclient-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php Frameworks</title>
		<link>http://www.ramirezcobos.com/2010/01/26/php-frameworks/</link>
		<comments>http://www.ramirezcobos.com/2010/01/26/php-frameworks/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 16:25:54 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=258</guid>
		<description><![CDATA[I decided to jump over the MVC (Model View Controller) pattern and on one of my linkedin groups I drop a question: Which one is best? A huge amount of PHP programmers started to join this discussion writing their personal PHP Framework tastes, providing me with a huge list of Frameworks I would like to]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/php_frameworks.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/php_frameworks-300x200.png"><img class="alignright size-full wp-image-299" title="php_frameworks-300x200" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/php_frameworks-300x200.png" alt="" width="300" height="200" /></a>I decided to jump over the MVC (Model View Controller) pattern and on one of my linkedin groups I drop a question:</p>
<p><em>Which one is best? </em></p>
<p>A huge amount of PHP programmers started to join this discussion writing their personal PHP Framework tastes, providing me with a huge list of Frameworks I would like to share with you. I don&#8217;t say that one is best that another, as one of the members said, there is no &#8216;best PHP MVC Framework, is whatever suits you best on your project goals&#8217;.</p>
<ul>
<li><a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a></li>
<li><a href="http://www.yiiframework.com/">Yii</a></li>
<li><a href="http://www.cakephp.org" target="_blank">CakePHP</a></li>
<li><a href="http://framework.zend.com/home" target="_blank">Zend</a></li>
<li><a href="http://www.symfony-project.com/" target="_blank">Symfony</a></li>
<li><a href="http://www.phpdevshell.org/" target="_blank">PHPDevShell</a></li>
<li><a href="http://www.pradosoft.com/" target="_blank">Prado</a></li>
<li><a href="http://www.akelos.org/" target="_blank">Akelos</a></li>
<li><a href="http://www.akelos.org/" target="_blank">ZooP</a></li>
<li><a href="http://qphp.net/" target="_blank">QPHP</a></li>
<li><a href="http://www.ez.no/ezcomponents" target="_blank">ezComponents</a></li>
</ul>
<p>I know the list could be much bigger, if you know more PHP Frameworks to add to this list, please comment and I will update it.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/26/php-frameworks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SWFUpload_0_0. Error HTTP Status: 403 Solved</title>
		<link>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/</link>
		<comments>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 11:21:18 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=161</guid>
		<description><![CDATA[SWFUpload is a client-side file upload tool originally developed by Vinterwebb.se. It uses a combination of Flash and JavaScript to provide file upload functionality beyond what the basic browser provides with the &#60;input type=&#8221;file&#8221; /&#62; tag. The main features that SWFUpload provides are: The ability to select multiple files in the file browser dialog. AJAX-style]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-6.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-6.png"><img class="alignright size-medium wp-image-312" title="Picture-6" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-6-300x143.png" alt="" width="300" height="143" /></a></a><br />
<a href="http://www.swfupload.org/">SWFUpload</a> is a client-side file upload tool originally developed by <a href="http://www.vinterwebb.se/">Vinterwebb.se</a>. It uses a combination of Flash and JavaScript to 	provide file upload functionality beyond what the basic browser provides with the &lt;input type=&#8221;file&#8221; /&gt; tag.</p>
<p>The main features that SWFUpload provides are:</p>
<ul>
<li>The ability to select multiple files in the file browser dialog.</li>
<li>AJAX-style uploading without a page refresh.</li>
<li>Upload progress events.</li>
<li>Namespaced classes compatible with other JavaScript libraries (i.e., jQuery, Prototype, etc.).</li>
<li>Flash 9 and Flash 10 support. (Flash 8 support dropped in version 2.2.0)</li>
</ul>
<p>SWFUpload is different from other Flash based upload tools because of the philosophy 		behind its design.  SWFUpload gives developers control by leaving the UI in the browser (as much as possible). 		Developers can use XHTML, CSS, and JavaScript to tailor the upload UI to the needs and 		style of their site.  Upload status updates are made through a set of simple JavaScript events. 		The developer uses these events to update the webpage as the file upload progresses.</p>
<h3>How to use it</h3>
<p>I am not going to explain how to use it, if any of you are interested on it, SWFUpload guys have developed a very <a href="http://demo.swfupload.org/Documentation/" target="_blank">good site explaining its full functionality</a>.</p>
<h3>The problem</h3>
<p>After successfully installing the component on one of my projects and working amazingly good on the local computer, when I uploaded the project to the server where I contracted the hosting, suddenly I had an error: SWFUpload_0_0. Error HTTP Status: 403.</p>
<p>I google to find a solution to my problem and found tons of people having the same issue and the answers where always the same. For example:</p>
<p><strong><span style="color: #000000;"><em>&#8220;You are getting a 403.  Which means &#8220;forbidden&#8221;.  This is something on the web server that you&#8217;ll have to figure out.SWFUpload doesn&#8217;t save the file. It just uploads it to your upload_url (upload.php). You need to add PHP code that saves the file. In PHP the uploaded file is found in $_FILE["Filedata"] by default.&#8221;</em></span></strong></p>
<p>Say what? I looked at my server&#8217;s configuration, checked folder permissions, reviewed my JS and PHP code&#8230; <strong>NOTHING</strong>. Then I thought it was something wrong with server POST Payload checks. Normally,<a href="http://www.modsecurity.org/documentation/modsecurity-apache/1.9.3/html-multipage/03-configuration.html" target="_blank"> this security configuration is disabled by default on Apache Servers</a> but my provider &#8216;could&#8217; possibly had this security check on. I had to try and&#8230;</p>
<h3>Solution</h3>
<p>I solved the issue by creating an .htaccess file and writing the following in it:</p>
<p><strong><em>SetEnvIfNoCase Content-Type &#8220;^multipart/form-data;&#8221; &#8220;MODSEC_NOPOSTBUFFERING=Do not buffer file uploads&#8221;</em></strong></p>
<p>Hope this also works for those having the same issue.</p>
<p><em>Happy New Year BTW!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Small Urls with PHP</title>
		<link>http://www.ramirezcobos.com/2009/12/16/creating-small-urls-with-php/</link>
		<comments>http://www.ramirezcobos.com/2009/12/16/creating-small-urls-with-php/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 11:23:18 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=85</guid>
		<description><![CDATA[Have you ever wanted to create small URLs like in Twitter? This service is provided by bit.ly and it is the one I normally use for my projects. It allows you to shorten any long URL (ie. http://www.ramirezcobos.com = http://bit.ly/8zivPq -click on it and you will be redirected here) and also gives you click statistiques.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-87" style="border:3px solid #ddd;margin:5px" title="bit.ly" src="http://www.ramirezcobos.com/wp-content/uploads/2009/12/Picture-5-300x115.png" alt="bit.ly" width="300" height="115" />Have you ever wanted to create small URLs like in Twitter? This service is provided by <a href="http://bit.ly" target="_blank">bit.ly</a> and it is the one I normally use for my projects. It allows you to shorten any long URL (ie. http://www.ramirezcobos.com = <a href="http://bit.ly/8zivPq">http://bit.ly/8zivPq</a> -click on it and you will be redirected here) and also gives you click statistiques.</p>
<p>Nevertheless, there are also other providers that allows you to create a small URL on the fly such as <a href="http://tinyurl.com" target="_blank">tinyurl.com</a> or <a href="http://to.ly" target="_blank">to.y</a>. If any of you wishes to create small urls through their PHP code here I got a set of functions (using CURL) for you use on your projects:</p>
<pre class="brush: php;">

function getTinyUrl($url){
		$ch = curl_init();
		$timeout = 5;
		curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
		$data = curl_exec($ch);
		curl_close($ch);
		return $data;
	}
function getToLyUrl($url){
		$ch = curl_init();

		curl_setopt($ch, CURLOPT_URL, 'http://to.ly/api.php?longurl='.urlencode($url));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_HEADER, 0);

		$data = curl_exec ($ch);
		curl_close ($ch);

		return $data;
	}
</pre>
<p><strong>Usage</strong></p>
<pre class="brush: php;">

$smallURL = getTinyUrl('http://www.ramirezcobos.com');

echo $smallURL; // will display the small URL
</pre>
<p><strong>Extras</strong></p>
<p>I include the following function too just in case, as I recommend you to check if  URLs are in correct format before using the above functions.</p>
<pre class="brush: php;">

function getParsedUrl($url)
	{
		$parsed_url = parse_url($url);

		if (!isset($parsed_url['scheme']) or $parsed_url['scheme'] != 'http'){
			echo 'Unsupported URL sheme given, please just use &quot;HTTP&quot;.';
			exit();
		}
		if (!isset($parsed_url['host']) or $parsed_url['host'] == ''){
			echo 'Invalid URL given!';
			exit();
		}

		$host = $parsed_url['host'];
		$host .= (isset($parsed_url['port']) and  !empty($parsed_url['port'])) ? ':'.$parsed_url['port'] : '';
		$path = (isset($parsed_url['path']) and  !empty($parsed_url['path'])) ? $parsed_url['path'] : '/';
		$path .= (isset($parsed_url['query']) and  !empty($parsed_url['query'])) ? '?'.$parsed_url['query'] : '';

		return 'http://' . $host . $path;
	}
</pre>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2009/12/16/creating-small-urls-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
