Random Post: Mail Of The Day
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About Me
  • My Publications
  • My Work Domain
  • phpResource Feeds

    Some Usage Examples of My XmlToArray Class

    July 4th, 2007

    I am very happy that my XmlToArray Class at PHPClasses.Org got a huge popularity. This class parses XML and forms array from the hierarchical XML format. You can download it from here:


    Recently few users requested me to provide a real-life example usage of my class. In this regard, I want to show two examples here:

    BBC News Feed : http://www.rupom.com/demos/bbc/

    Cricinfo Latest : http://www.rupom.com/demos/cricinfo/

    Screenshot of XmlToArray Usage Example
    I want to share my usage.php that I used for BBC News Feed. Here it is:


    // Retrieving the RSS first. I used file_get_contents(), you can retrieve by any other way
    $xml_data = file_get_contents(“http://newsrss.bbc.co.uk/rss/ newsonline_world_edition/front_page/rss.xml”);

    //Creating Instance of the Class
    $xmlObj = new XmlToArray($xml_data);

    //Creating Array
    $arrayData = $xmlObj->createArray();

    $rssData = array();
    //getting the feed items
    $rssData = $arrayData[‘rss’][‘channel’][0][‘item’];

    // data is available; loop through the data

    foreach($rssData as $i=>$v)

    $title = $v[‘title’];
    $link = $v[‘link’];
    $category = $v[‘category’];
    $pubDate = $v[‘pubDate’];
    $desc = $v[‘description’];

    /* print data now


    Isn’t this the simplest script? Yes, I tried to make it as simple as possible. Please feel free to let me know more queries.

    Best regards.


    phpBB Topic Map

    July 1st, 2007

    Few months back, I worked on “phpBB topic map” for one of my good friends. It’s a new kind of site map (in this case I called “topic map”). I just want to show you the new kind mapping stuff. You can see the working version here:


    phpBB Topic Map

    If you mouse over any link, you will see OVERLIB functios here. The forum->topic hierarchy has been derived in conventional way (as per phpBB’s database structure). There is nothing special here except the new idea of mapping phpBB topics with a flavor of OVERLIB.

    Please feel free to contact me for any helps.

    Best regards.


    See My Simple Image Thumbnailer

    June 30th, 2007

    Last week when I noticed the MYRUET members could not upload proper sized image to their profile page, I prepared a simple image thumbnailer. I donno if it helped them a lot but I noticed few members used it. Here is the demo:


    It is very simple one to prepare. It manipulates the would-be scale size using this formula:


    function imageScale($image, $newWidth, $newHeight)

    if(!$size = @getimagesize($image))
    die("Unable to get info on image $image");

    $ratio = ($size[0] / $size[1]);

    if($newWidth == -1)
    $ret[1] = $newHeight;
    $ret[0] = round(($newHeight * $ratio));
    else if($newHeight == -1)
    $ret[0] = $newWidth;
    $ret[1] = round(($newWidth / $ratio));

    die("Scale Error");

    return $ret;


    Please check the thumbnailer and let me know if some changes can make this more strong.

    Best regards.


    Easy Way to Install FFMPEG with PHP

    June 15th, 2007

    Audio/Video streaming is very popular today. Recently I have worked on such streaming for one of my projects. My server OS is Fedora Core 6. I found a great help to install FFMPEG (with PHP) that I want to share:


    I followed it line by line and got FFMPEG done. Obviously you will face some problems (depending on your OS and current status of the server). I had to do a few configuration stuffs that my server required during the installation.

    I hope you will find the above link as a great help when needed.



    Gmail Address Book Grabber :: New Update

    June 14th, 2007

    Please check the updated version of my class “Gmail Address Book Grabber”:


    This update is because Gmail changed few display & URL styles in the recent days. I have modified the data parser and a request URL in this change. It’s working now. See demo here:


    Please feel free to share your experience with my class.

    Enjoy PHPing!


    Tell A Friend (TAF) System With Gmail, Yahoo, MSN, AOL Contact List Grabbers

    November 22nd, 2006

    Recently I prepared a simple Tell A Friend (TAF) System with Gmail, Yahoo, MSN, AOL contact list grabbers. We all know that Tell A Friend (TAF) is a very important part now-a-days for any well-organized/planned website. Also many sites (especially social networking sites) facilitates TAF with contact list importing from major email providers (Gmail, Yahoo, MSN, AOL). From that needs, I tried to implement a simple TAF system with contact list importing facility from major email address providers. Here is my live demo:


    During this work, I got helps from my friends especially Shimul, Ehsan, Arif and Riyadh. My special thanks and gratitude to them. They inspired me a lot to do such work.

    Tell A Friend System with Gmail, Yahoo, MSN, AOL Contact List Grabbers

    Please see my demo and send comments so that I can release a better version of this system. Also feel free to contact me if you want this TAF integrated into your website.

    I am hoping to release a better and stable version of this work in the near future.


    cURL Callback Function

    September 3rd, 2006

    Usually we get cURL response from curl_exec(). But we have options to get the output using callback functions. We can set callback function for both header and body output. Here is an example:

    //Init curl session
    $ch = curl_init();
    //Set URL
    curl_setopt($ch, CURLOPT_URL, ‘http://www.php.net/’);
    // Set callback function for headers
    curl_setopt($ch, CURLOPT_HEADERFUNCTION, ‘read_header’);
    // Set callback function for body
    curl_setopt($ch, CURLOPT_WRITEFUNCTION, ‘read_body’);
    //Execute curl

    //close curl session

    //Callback function for header
    function read_header($ch, $string)
    $length = strlen($string);
    echo “Header: $string
    return $length;

    //Callback function for body
    function read_body($ch, $string)
    $length = strlen($string);
    echo “Received $length bytes
    return $length;

    This script demonstrates how you can set callback functions to receive the HTTP response as it comes through. It’s really easy to use but nice feature.

    Enjoy PHPing !


    Important Issues in Sending HTML Email

    August 8th, 2006

    If you want your HTML email to put into recipient’s INBOX, you have to follow some rules.
    Following are some important issues for sending HTML email:

    1. Remove unnecessary HTML tags:

    Remove these tags from your mail content:
    – <html>, </html>
    – META Tag
    – HEAD
    – BASE
    – LINK
    – TITLE
    – Comments

    2. Use table for layout

    Because of the very limited support of style sheets in webmail clients, the best and safe way to layout your html e-mail is to use tables.

    3. Use Online Image

    4. Hide Image Toolbar

    5. Use Shortcut URLs:
    URLs of email should be short/small.

    6. Dont Use Anchors

    7. Use Simple Inline Stylesheet

    For example:
    <td style=”font-family: Verdana, Arial, Helvetica, sans-serif; font-size:
    10px;” >Vivamus ut sem. Fusce aliquam nunc vitae purus. </td >

    8. Create your design with a white background color

    Most webmail and e-mail clients use a white background color to display messages.

    <td bgcolor=”#FF0000″>

    9. Use the title attribute instead of alt

    The alt attribute for images doesn’t work in Gecko-based browsers such as Firefox and Mozilla

    10. Use <br /> instead of <p>

    11. Don’t use forms

    12. Don’t use _JavaScript:
    _JavaScript in HTML e-mail is never a good idea because of all the dangerous scripting (for example XSS attacks) that can be executed. For this reason most webmail and e-mail clients disable _JavaScript by removing or ignoring it.

    13. Provide a link for display in the browser

    14. Keep Your Subject Short and Informative

    15. Don’t Use DHTML and Flash

    16. Send your e-mail as multipart/alternative

    If you send a HTML e-mail to people with a webmail or e-mail client who can’t read HTML e-mail, they will only see the HTML code. If you don’t know what your recipients use, send your e-mail as multipart/alternative. This is the HTML version and the plain text version.

    These issues greatly affect the HTML email. Currently I am working on a project where the emails must have to be sent to INBOX. I got success following these issues. I am researching more on that.


    Gmail Address Book Grabber :: New Demo

    July 23rd, 2006

    Yesterday I updated the “Gmail Addressbook Grabber” class and put it to my site’s demo section. From now on, you will see the live example of this class in my site. Please follow this location and see the addressbook grabber:


    Changes took places in this version are:
    – CURL enability is no longer the only option to use this class
    – fsockopen has been used as an alternative of CURL
    – “Connection Closing” is performed as soon as the data is retrieved from Gmail

    Feel free to suggest me about this new version.


    Submit Codes to phpResource Coding Contest

    July 23rd, 2006

    We, phpResource Group, started the coding contest at the beginning of this month. We were expecting many codes from the members of the group. Already some members participated the coding contest. But the expectation was too much big for this coding contest. We expected at least 50 codes from the members, but got a very few. This is because many members thought that their codes might not be good enough for the contest. But I would like to express my theme positively for them. You no need to hesitate about your code – feel free and participate the contest, may be something very innovative is hidden inside your code. We encourage you to submit codes to the contest.

    To submit code, please go to http://contest.phpresgroup.org and login with your login credientials. If you are not a member of phpResource Group, please join phpResource Group first, register at http://contest.phpresgroup.org and submit your codes. Once you submitted your code, you will get your code listed to Code Gallery as a participant.
    Best wishes for you – you may be winner of this month.

    Currently we have three sponsors for this coding contest. Three prizes will be distributed among the winners.

    Participate the coding contest – broaden your coding horizon !