I feel like the request being sent is erroneous.

it was:
        fputs($fp,"GET/scripts/online.dll?icq=$uin&img=5HTTP/1.0\n\n");

It should be:
        fputs($fp,"GET /scripts/online.dll?icq=$uin&img=5 HTTP/1.0\n\n");


And beside that it seems it is an outdated URL


Elias

"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Has anyone built, or partially built an interface to ICQ?

I'm not necessarily looking for full IM thru a web/PHP interface, but maybe
some small stuff, like finding out if a certain user is online?

I did a google and found this on Zend.com, but can't get it working (it
returns "unknown" everytime, with any number):

<?
function get_status($uin)
    {
    /*************************************
    * Copyright  2000 Scriptmakers.com *
    * Feel free to edit, modify and*
    * redistribute as long as this*
    * message is kept intact.*
    *************************************/

    $fp = fsockopen("wwp.icq.com", 80, &$errno, &$errstr, 30);
    if(!$fp)
        {

        echo "$errstr($errno)<br>\n";
        }
    else
        {
        fputs($fp,"GET/scripts/online.dll?icq=$uin&img=5HTTP/1.0\n\n");
        $do='no';
        while(!feof($fp))
            {
            $line=fgets($fp,128);
            $do=($do=='yes')?'yes':(eregi("^GIF89",$line))?'yes':'no';;
            if($do=='yes')
                {
                if(ereg("7@ 40",$line))
                    {
                    return 'online';
                    }
                elseif(ereg("w` 40",$line))
                    {
                    return 'offline';
                    }
                elseif(ereg("S3IѱJ",$line))
                    {
                    return 'disabled';
                    }
                }
            }
        fclose($fp);
        }
    return 'unknown';
    }

/* -------- usage ----------
include('icq_status.php');
$uin=51362125;
echoget_status($uin);
----------------------------*/
?>


... and this, which spits out an error:
"Warning: file("http://wwp.icq.com/scripts/online.dll?icq=&img=1";) -
Undefined error: 0 in /usr/local/apache/htdocs/hinge/viewmember.php on line
13"

<?

$uin = "51362125";
function ICQ_Status($uin)
{
 $arr = file("http://wwp.icq.com/scripts/online.dll?icq=$uin&img=1";);
 $len = strlen($arr[1]);
 if ($len == "") return "ICQ: <span style=\"color:#707070\">Local
Server</span>";
 if ($len == 96) return "ICQ: <span style=\"color:#009000\">Online</span>";
 if ($len == 83) return "ICQ: <span style=\"color:#b00000\">Offline</span>";
 if ($len == 1) return "ICQ: <span style=\"color:#000080\">Disabled</span>";
}
echo ICQ_Status($uin);

?>


My guess is that these both DID work at one point, but if ICQ keeps changing
their methods, then the scripts become redundant.


Any links / guidance would be great!


Justin French




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to