AIM Status Checker?

Discussion in 'PHP' started by cbaskauskas, Mar 26, 2008.

  1. #1
    Does anybody have any experience with using PHP to create an AIM status checker? I'm trying to figure it out, but I seem to be at a roadblock.
     
    cbaskauskas, Mar 26, 2008 IP
  2. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #2
    what do you mean by status checker?
     
    SimThePhpCoder, Mar 26, 2008 IP
  3. cbaskauskas

    cbaskauskas Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    cbaskauskas, Mar 26, 2008 IP
  4. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #4
    google php aim. your find a php aim class on sourceforge. that should help ;]
     
    SimThePhpCoder, Mar 27, 2008 IP
  5. cbaskauskas

    cbaskauskas Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks I'll try it out and give an update later.
     
    cbaskauskas, Mar 27, 2008 IP
  6. J.T.D.

    J.T.D. Peon

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You have 2 choices. Either go to AOL's website and register for a Developer Status. Then use this code (Made by Me)

    
    <?php
    #----[ Made By J.T.D. ]-----#
    
    // Config
    $key = ''; //Enter your developer key you got from AOL.
    
    
    function getAIMdata($username) {
        $aim = new domDocument;
        $aim->load('http://api.oscar.aol.com/presence/get?k='.$key.'&f=xml&t='.$username);
        $aim = simplexml_import_dom($aim);
        $status = array();
        $status[code] = $aim->response[0]->statusCode;
        $status[text] = $aim->response[0]->statusText;
        $aimId = $aim->data[0]->users[0]->user[0]->aimId;
        $displayId = $aim->data[0]->users[0]->user[0]->displayId;
        $state = $aim->data[0]->users[0]->user[0]->state;
        $buddyIcon = $aim->data[0]->users[0]->user[0]->buddyIcon;
        $onlineTime = convert($aim->data[0]->users[0]->user[0]->onlineTime);
    	return format($aimId,$displayId,$state,$onlineTime,$buddyIcon);
    }
    
    function convert($sec, $padHours = false) {
        $hms = null;
        $hours = intval(intval($sec) / 3600); 
        $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' : $hours. ':';
        $minutes = intval(($sec / 60) % 60); 
        $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
        $seconds = intval($sec % 60);
        $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
        return $hms;
    }
    
    function format($aimid,$displayid,$staTe,$onlinetime,$buddyicon) {
    	if ( $staTe != 'online' ) {
    		return '<pre>
    Aim ID: '.$aimid.'
    Display ID: '.$displayid.'
    Online/Offline: '.$staTe.'
    Online Time: N/A
    Icon:
    <center>N/A</center>
    </pre>';
    
    	} else {
    		return '<pre>
    Aim ID: '.$aimid.'
    Display ID: '.$displayid.'
    Online/Offline: '.$staTe.'
    Online Time: '.$onlinetime.'
    Icon:
    <center><img src="'.$buddyicon.'" alt="'.$displayid.'\'s Icon" title="'.$displayid.'\'s Icon"></center>
    </pre>';
    	}
    }
    
    echo getAIMdata($_REQUEST['nick']); // <--- Access data by putting a ?nick=AIMNICKNAME at the end of the file name.
    ?>
    
    PHP:
    Or for a simpler one: (No Developer Key Needed)

    
    $on = 'ONLINE_IMAGE.jpg';
    $off = 'OFFLINE_IMAGE.jpg';
    echo '<img src="http://big.oscar.aol.com/'.$_GET['sn'].'?on_url='.$on.'&off_url='.$off.'" alt="" />';
    // How to use: Access data by putting a ?sn=AIMNICKNAME at the end of the file name.
    
    PHP:
    - JTD
     
    J.T.D., Mar 27, 2008 IP
  7. cbaskauskas

    cbaskauskas Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks, that is extremely helpful. I will tinker with it and if I have any questions I'll come back.
     
    cbaskauskas, Mar 27, 2008 IP