Deprecated: Function set_magic_quotes_runtime() is deprecated in /nfs/c01/h08/mnt/2939/domains/cidamon.com/html/blog/textpattern/lib/txplib_db.php on line 14
Cidamon: Blog: PHP

PHP

  • image resize function (transperant)
    26 April, 2009

    Found a great function for image resize in php. It requires php >= 4.3.0.
    I found the source in
    http://www.akemapa.com/2008/07/10/php-gd-resize-transparent-image-png-gif/

    <?
    function resize($img, $w, $h, $newfilename) {
        #
        //Check if GD extension is loaded
        #
        if (!extension_loaded('gd') && !extension_loaded('gd2'))...

    more..

  • Simple use of CURL
    05 January, 2009

    Here is a very simple structure of how to use curl with post method –

    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,'http://example.com/target.php');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);	
    curl_setopt($ch, CURLOPT_POST , 1);// setting up to use post method
    curl_setopt($ch, CURLOPT_POSTFIELDS, array("fieldName1"=>"data1","fieldName2"=>"data2"));							
    $content = curl_exec($ch);
    curl_close($ch);
    
  • Stop cron job from sending output email
    05 January, 2009

    I created a cron job which needs to run every 5 minutes. So it was sending me 12 emails per hour and my inbox got overwhelmed by email pretty soon. I had plesk control panel and plesk won’t let you leave email field empty so I started to look...

    more..

  • Store file in MySql using PHP
    14 June, 2008

    Here is a good article on how to store file in mysql using php

    Blobbing Data With PHP and MySQL

  • image resize function (transperant)
    26 April, 2009

    Found a great function for image resize in php. It requires php >= 4.3.0.
    I found the source in
    http://www.akemapa.com/2008/07/10/php-gd-resize-transparent-image-png-gif/

    <?
    function resize($img, $w, $h, $newfilename) {
        #
        //Check if GD extension is loaded
        #
        if (!extension_loaded('gd') && !extension_loaded('gd2'))...

    more..

  • Simple use of CURL
    05 January, 2009

    Here is a very simple structure of how to use curl with post method –

    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,'http://example.com/target.php');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);	
    curl_setopt($ch, CURLOPT_POST , 1);// setting up to use post method
    curl_setopt($ch, CURLOPT_POSTFIELDS, array("fieldName1"=>"data1","fieldName2"=>"data2"));							
    $content = curl_exec($ch);
    curl_close($ch);
    
  • Stop cron job from sending output email
    05 January, 2009

    I created a cron job which needs to run every 5 minutes. So it was sending me 12 emails per hour and my inbox got overwhelmed by email pretty soon. I had plesk control panel and plesk won’t let you leave email field empty so I started to look...

    more..

  • Store file in MySql using PHP
    14 June, 2008

    Here is a good article on how to store file in mysql using php

    Blobbing Data With PHP and MySQL