[ask for correction] yahoo messenger with Custom Status image

Discussion in 'Programming' started by planto, Jan 24, 2012.

  1. #1
    I hope this goes to the right section. If it is not, Please kindly remove it to proper section. Thanks.


    ok, my goal is to change Yahoo messenger standard online status images which I can get from the code below :

    <a href=”ymsgr:sendIM?user_id”>
    <img src=”http://opi.yahoo.com/online?u=user_id&m=g&t=2” border=”0″/></a>

    so I made a script. and it looks like this :

    <?php
    # make header image PNG
    header("Content-Type: image/png");
    # check to yahoo with curl function in php
    $cURL = curl_init();
    curl_setopt($cURL, CURLOPT_URL, "http://opi.yahoo.com/online?u=valkedin&m=s");
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
    $strPage = curl_exec($cURL);
    curl_close($cURL);
    
    # if offline, variable will be changed to gambar offline file
    if ($strPage=="valkedin is NOT ONLINE")
    {$gambar="http://www.webaddress.com/images/ym/ymoff.png";}
    #if online, variable will be changed to gambar online file
    else
    {$gambar="http://www.webaddress.com/images/ym/ymon.png";}
    
    # recreate images
    $buatgambar = imagecreatefrompng($gambar);
    imagepng($buatgambar);
    imagedestroy($buatgambar);
    ?> 
    PHP:
    the idea is like this :

    if we access http://opi.yahoo.com/online?u=valkedin&m=s , it will return the value whether valkedin is ONLINE or valkedin is OFFLINE

    so my idea is to change the images based on the result obtained from that status.

    if valkedin is online, the online images will occur
    if valkedin is offline, the offline images will occur


    after I make the file, I saved it with file name ym.php under the folder ym. So the structure will be http://www.webaddress.com/images/ym/ym.php
    and the images files will be ymon.png and ymoff.png under the same folder http://www.webaddress.com/images/ym/ymon.png and http://www.webaddress.com/images/ym/ymoff.png



    after this, I put the code snippet at my html file <img src="images/ym/ym.php" alt="Yahoo Messenger" /> it is error and this is the error log

    [24-Jan-2012 18:43:07] PHP Warning:  imagecreatefromgif() [<a href='function.imagecreatefromgif'>function.imagecreatefromgif</a>]: Filename cannot be empty in /home/xxx/public_html/images/ym/ym.php on line 17
    [24-Jan-2012 18:43:07] PHP Warning:  imagegif(): supplied argument is not a valid Image resource in /home/xxx/public_html/images/ym/ym.php on line 18
    [24-Jan-2012 18:43:07] PHP Warning:  imagedestroy(): supplied argument is not a valid Image resource in /home/xxx/public_html/images/ym/ym.php on line 19
    Code (markup):



    Please kindly help me to check the problem.
     
    planto, Jan 24, 2012 IP