Hi to all !
I have questions for you.
Now I build some CMS system and it include function to check, that ICQ user in on-line or not. Do you have any minds ?
ICQ-user in on-line or not ?
PHPist,
there are two ways you can do this. The first is simple but less flexable, the second is more complex but also more flexable.
Option One
Go to: http://www.icq.com/features/web/indicator.html
You can simply download an indicator that will show if you are online or not. However, this does not allow you to access your status in your PHP code.
Option Two
In your php code, do somthing like:
<?PHP
$img = file('http://status.icq.com/online.gif?icq=[COLOR=Red]YOUR_ICQ_NUMBER_HERE[/COLOR]&img=5');
echo md5($img);
?>
Do this for when you are offline and online on ICQ, and you should get two different hashes, for example 'abc' (when online) and '123' (when offline) (but of course, yours will be much longer). Now, use this code to detect if you are online or not:
<?PHP
$onHash = 'abc';
$offHash = '123';
$img = file('http://status.icq.com/online.gif?icq=[COLOR=Red]YOUR_ICQ_NUMBER_HERE[/COLOR]&img=5');
$hash = md5($img);
if($hash == $onHash){
//you are online
}else if($hast == $offHash){
//your are offline
}
?>
That should do it. However, this is untested, i just figure that it should work. You may need to play around a bit.
Great ! Thanks.
That's full example:
<?
$onHash='501aa29a5565a264b1257b66bcbf82ea';
$offHash='e6344d371ce6341148c6f362d8ff0d84';
$img =join('', file('http://status.icq.com/online.gif?icq=261502771&img=5'));
$hash = md5($img);
if($hash==$onHash){
print"Пользователь в сети !";
}elseif($hash==$offHash){
print"Пользователь в оффлайне !";
}
?>