Jump to content

checking aim user status


smartalco

Recommended Posts

im trying to check the status of an aim user and display whether or not they are online on a page, i copied the following script from a tutorial site, only it isn't working, and i don't really have any idea whats wrong :/

<?php// Connect to AOL server$url = @fsockopen("big.oscar.aol.com", 80, &$errno, &$errstr, 3);// Query the Serverfputs($url, "GET /testing_nick?on_url=online&off_url=offline HTTP/1.0\n\n");// See resultant pagewhile(!feof($url)){	$feofi++;	$page .= fread($url,256);	if($feofi > 10){		$page = "offline";		break;	}}fclose($url);// determine online status if(strstr($page, "online")){	echo "<br />" . $page . " the user is online";}else{	echo "<br />" . $page . " the user is offline";}?>

i get the following error, plus it still says im offline even if im not

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in /usr2/web/tlc/index.php on line 43

can anyone help me with this? (in a way so i don't have to edit php.ini)

Link to comment
Share on other sites

ok, i got rid of the error message by replacing

$url = @fsockopen("big.oscar.aol.com", 80, &$errno, &$errstr, 3);

with

$url = @fsockopen("big.oscar.aol.com", 80, $errno, $errstr, 3);

but, this script is still not functioning, does anyone know of another script to do this?

Link to comment
Share on other sites

You probably don't need to trash the entire script, right? It's probably easier to figure out why this is not working and fix it instead of creating a new one from scratch.The @ operator in front of fsockopen is suppressing error messages for that function. Remove the @ sign to see if errors are happening when you open the socket. Also, you can print out $errno and $errstr to check the error status of the connection.Also, add these lines to the top. There are several uninitialized variables.

$errno = $errstr = $page = "";$feofi = 0;

If it still doesn't work, it might be better to skip using sockets and just get the page. I'm not entirely sure what the code is doing with the loop that reads the page, I'm not sure why you would set $page equal to "offline" if there are more then 2500 bytes in the response.

Link to comment
Share on other sites

im trying to check the status of an aim user and display whether or not they are online on a page, i copied the following script from a tutorial site, only it isn't working, and i don't really have any idea whats wrong :/
<?php // Connect to AOL server $url = @fsockopen("big.oscar.aol.com", 80, &$errno, &$errstr, 3);  // Query the Server fputs($url, "GET /testing_nick?on_url=online&off_url=offline 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 "<br />" . $page . " the user is online"; }else{	 echo "<br />" . $page . " the user is offline"; } ?>

i get the following error, plus it still says im offline even if im not

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in /usr2/web/tlc/index.php on line 43

can anyone help me with this? (in a way so i don't have to edit php.ini)

Guessing you got that script from Spoono? im not seeing anything immediately wrong with what you're doing but it could be that the specific php_ini value is not set... i just wish i could remember what it was. I think it was allow_call_time_pass_reference, but i may be wrong. try putting this at the top of your file:ini_set('allow_call_time_pass_reference',1);otherwise i dont know why it wouldnt work.
Link to comment
Share on other sites

i just wish i could remember what it was. I think it was allow_call_time_pass_reference, but i may be wrong. try putting this at the top of your file:ini_set('allow_call_time_pass_reference',1);
that didn't seem to do anything, i tried setting it to true as well
The @ operator in front of fsockopen is suppressing error messages for that function. Remove the @ sign to see if errors are happening when you open the socket. Also, you can print out $errno and $errstr to check the error status of the connection.
did that, nothing happened after removing the @, but i did get the errno and errstr, errno-113, errstr-No route to hostthat would seem to me to be that it isn't even connecting to the server from that error, should i try a different port maybe?
Link to comment
Share on other sites

ok, scratch all that, in my search for a fix to that problem i found a ridiculously easier solution

<img src="http://big.oscar.aol.com/screename?on_url=http://*direct url of online image*&off_url=http://*direct url of offline image*">

just replace 'screename' with your screename, and replace the asterick comments with what they say to (direct url being ie: www.whatever.com/image.png)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...