Archive for December, 2010
PHP: Nice URL shortener to use from PHP
In this post I would like to present you a nice URL shortening service that you may use from PHP in a very simple way (perhaps simplest possible!).
Let’s say you want to shorten url like this:
http://www.my-website-is-here.com/index.php?subpage
To do this you need this simple code:
$url = ‘http://www.my-website-is-here.com/index.php?subpage’;
$new_url = file_get_contents(‘http://is.gd/api.php?longurl=’ . urlencode($url));
Now you can echo $new_url to see [...]
PHP: Smarty: {foreach} doesn’t render my array
On one of the websites I work I couldn’t render an array in a smarty template. My code looked like this:
{foreach from=$myarray key=mykey item=items}
<h2>{$mykey}</h2>
{foreach from=$items item=it}
{$it.value}
{/foreach}
{/foreach}
I used print_r in my controller to show content of $myarray and it was just fine. After a while I found the error: Zend Framework did not allow me
to work [...]
Fatal error: Call to undefined function exif_read_data() in www\index.php on line 10
I recently got this error while trying to read EXIF data from jpegs.
So I enabled exif extension in php.ini but when I restarted Apache
I was informed that “php_exif.dll cannot not be found”.
I checked “ext” directory of my PHP installation and the file was there.
After doing some research I discovered that in order to use EXIF [...]