this would help:
http://www.php.net/manual/en/index.functions.php

$url = "" href="http://big.oscar.aol.com/">big.oscar.aol.com", 80, &$errno, &$errstr, 3);
http://www.php.net/manual/en/function.fsockopen.php
fsockopen -- Open Internet or Unix domain socket connection
@
-- supresses errors
$url -- is the result resource of the http request
fputs($url, "GET /spoonosupport? HTTP/1.0\n\n");
http://www.php.net/manual/en/function.fwrite.php
fwrite -- Binary-safe file write (something like printf)
do a GET request on the opened url
while(!feof($url)){
...
}
store the output of the GET request in $page, unless output exceeds 2560bytes then store "offline"

if(strstr($page, "online")){
...
}
http://www.php.net/manual/en/function.strstr.php
strstr -- Find first occurrence of a string
look for the word online in $page otherwise he's offline
Al-Faisal El-Dajani <[EMAIL PROTECTED]> wrote:
Hey PHP gurus,

Here is some PHP code that checks for the status of a person using AIM (AOL Instant Messenger)...I can get the general idea of the code, but can some php guy explain to me the different parameters and what they are for?
Of speical interest to me is the fsockopen statement. And what does the fputs statement return??
I'm trying to understand it to rewrite it in Tcl :(


<?
// Connect to AOL server
$url = "" href="http://big.oscar.aol.com">big.oscar.aol.com", 80, &$errno, &$errstr, 3);

// Query the Server
fputs($url, "GET /spoonosupport? HTTP/1.0\n\n");


// See resultant page
while(!feof($url)){
$feofi++;
$page .= fread($url,256);
if($feofi > 10){
$page = "offline";
break;
}
}
fclose($url);

// determine online status

if(strstr($page, "online")){
echo "the user is online";
}else{
echo "the user is offline";
}
?>

thanx
--
Al-Faisal El-Dajani
Tel: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan

May the source be with you _______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org

Reply via email to