Page 1 of 1

Connecting to TOC2 (AIM) Server & sending & receivin

Posted: Sat Mar 25, 2006 6:23 am
by psychotomus
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


im trying to connect to the toc2 (AIM) server and send a instant messeger to people thru php. im not sure if its sending the data i need to the server or not. here's what i have. 2 different ways. not sure if it should be udp or not.


After sending FLAPON. it should send "1" back to the client.

Code: Select all

<?php

$vbCrLf = chr(13) + chr(10);


$fp = fsockopen("udp://toc.oscar.aol.com", 5190, $errno, $errstr);
if (!$fp) {
   echo "ERROR: $errno - $errstr<br />\n";
} else {
	fwrite($fp, "FLAPON".vbCrLf.vbCrLf);
	echo fread($fp, 26);
	fclose($fp);
}


$fp = fsockopen("toc.oscar.aol.com", 5190, $errno, $errstr, 30);




  if (!$fp) 
  {      
  	echo "$errstr ($errno)<br>";  
  }
  else
  {
  		fwrite($fp, "FLAPON".vbCrLf.vbCrLf); 
	  	while (!feof ($fp)) 
	  	{
		   $buffer = fgets($fp, 4096);
		   flush();
		   echo $buffer;
		}
	}
	


fclose ($fp);

?>

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sat Mar 25, 2006 7:36 am
by s.dot
I've never done anything like this, so forgive me if my response is way off base.

Should

Code: Select all

fwrite($fp, "FLAPON".vbCrLf.vbCrLf);
be

Code: Select all

fwrite($fp, "FLAPON".$vbCrLf.$vbCrLf);
?

Posted: Sat Mar 25, 2006 1:46 pm
by psychotomus
thats right scottayy. overlooked the basics, but its still not working. ;[

Posted: Sat Mar 25, 2006 2:42 pm
by John Cartwright
what is the output??

Posted: Sat Mar 25, 2006 7:13 pm
by psychotomus
what output? it displays nothing.

Posted: Sat Mar 25, 2006 9:51 pm
by John Cartwright
error reporting on? error level set to E_ALL?

Posted: Sun Mar 26, 2006 12:13 am
by psychotomus
how do I do that?

Posted: Sun Mar 26, 2006 12:22 am
by John Cartwright
run this and tell me what the output is

Code: Select all

<?php

$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$eol = (isset($_SERVER['HTTP_HOST']) ? "<br />\n" : "\n");

$ec = array(
   'E_STRICT' => 2048,
   'E_ALL' => 2047,
   'E_USER_NOTICE' => 1024,
   'E_USER_WARNING' => 512,
   'E_USER_ERROR' => 256,
   'E_COMPILE_WARNING' => 128,
   'E_COMPILE_ERROR' => 64,
   'E_CORE_WARNING' => 32,
   'E_CORE_ERROR' => 16,
   'E_NOTICE' => 8,
   'E_PARSE' => 4,
   'E_WARNING' => 2,
   'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
   if (($t & $v) == $v)
   {
      $e[] = $n;
      $t ^= $v;
   }
}
$er = $er . ' (' . implode(' | ', $e) . ')';

echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Short Tags: ' . $so . $eol;
echo 'Display Errors: ' . $de . $eol;

?>

Posted: Sun Mar 26, 2006 10:16 am
by psychotomus
PHP Version: 4.3.5
PHP OS: WINNT
Error Reporting: 341 (E_USER_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_PARSE | E_ERROR)
Register Globals: On
Short Tags: On
Display Errors: On

Posted: Mon Mar 27, 2006 11:42 am
by psychotomus
well Jcart?