mIRC Home    About    Download    Register    News    Help

Print Thread
#214554 08/08/09 03:02 AM
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Im trying to communicate thru a webserver to a mIRC Client. Right now its connecting but when i try and write to the mIRC client from the php file the mIRC Client Gives me an error
Code:
* /echo: insufficient parameters (line 12, script3.mrc)


PHP Script
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Socket TEST - ix007</title>
</head>

<body>
<?php

$rc = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (socket_connect($rc, 'myip', '9090')) { 
socket_write($rc, "SUP BROSKIS");
echo "connected";
}

?>
</body>
</html>


mIRC Script
Code:
alias test if ($1) { socklisten test $$1 | echo -s Now Listening for a connection on port $1 & on  $ip $+ . }
on *:socklisten:test: {
  ;this listenning the socket achat for connections, if a connection happen, the connection
  ;will be accepted. This only triggered on server
  sockaccept rawr
  sockclose $sockname
  ;this close the sockname because no more connections are accepted and accept schat
  echo -a Socket connected 
}
on *:sockread:rawr: {
  sockread %schat
  echo -a %schat

}


I open the connection and port correctly and get a connection but i keep getting the error
Code:
* /echo: insufficient parameters (line 12, script3.mrc)


I dont know what I can do to fix that. Thanks for the help in advance!

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Obviously this line:

echo -a %schat

is causing your problems. The easiest way to prevent that error (during testing) is to add a static character to the echo line, like this:

echo -a > %schat

As for why you are getting a blank line from the socket, that would likely be a question for a PHP expert.

-genius_at_work

Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
I know the line # and what it says. I just dont know why its happening! Thanks.

Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Fixed just needed to add php escape characters /r/n to the end of my line. Thanks for the help!


Link Copied to Clipboard