How i can make a chat page in php in simple

Questions by mrbaliram   answers by mrbaliram

Showing Answers 1 - 4 of 4 Answers

Prasanna

  • Jul 10th, 2006
 

First of all we have to make one .txt file ...then open it in write mode then write something in messsage box that will written in that file ...the another user also open that file and write the file with the mesage box....Also open the file in read mod in side window to see what the another user is write ...IN this way we can make simple chat file with php ....BY :- Prasanna R Raval

Archana Jayaseelan

  • Feb 7th, 2007
 

First, establish a simple socket connection.
If in UNIX/LINUX,
use AF_INIX.function
get_the_host($host,$path)
{
// open the host
$fp = fsockopen($host, 80, &$errno, &$errstr, 30);
// take control of server timeout
stream_set_blocking($fp, 1);
// send the appropriate headers
fputs($fp,"GET $path HTTP/1.1rn");
fputs($fp,"Host: $hostrnrn");
$x = 1;
// grab a bunch of headers
while ($x < 10) :
$headers = fgets($fp, 4000);

print $headers;
$x++;
endwhile;
// close the filepointer.
fclose($fp);
}

get_the_host('www.php.net', '/');
?>

Thats a simple script for establishing socket connection.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions