Delphi & PHP Programming
| From: | Quique | Date: | Mon, 01 Apr 2002 17:51:24 +0000 |
| Subject: | Delphi & PHP Programming | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90987@lists.php.net to get a copy of this message | ||
I need someone who knows about Indy Components and PHP programming.
I use a TidTCPServer which is active at port 4250 listening 4
connections.
When i connect from another machine in my LAN, using PHP, the TCPServer
tells me, that's right...
The problem is when i want to read a text from the client (PHP).
TCPServer tells me that a message came, but it doesn't shw it to me.
Following is the code i use.
procedure TMainForm.TCPServerConnect(AThread: TIdPeerThread);
begin
MessageDlg('User has connected from web', mtInformation, [mbOK], 0);
end;
...
procedure TMainForm.TCPServerExecute(AThread: TIdPeerThread);
Var
Msg:String;
begin
{ Get the text sent from the client }
Msg := AThread.Connection.ReadLn;
MessageDlg('Message received: '+Msg, mtInformation, [mbOK], 0);
end;
...
This is PHP code (connect.php)
----------------
<?php
//try to connect to the TCPServer on 10.0.0.8
$fp = fsockopen("10.0.0.8",4250,&$errno,&$errstr,30);
//if can't connect, show error
if(!$fp) {
echo "Error connecting. Try later.";
echo "<br>$errstr ($errno)<br>\n";
}
else {
if (empty($field_msg)) {
echo "<form name=\"formsend\" method=\"post\" action=
\"connect.php\">Message: ";
echo "<input type=\"text\" name=\"field_msg\" size=\"30\"
maxlength=\"150\"><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Send
message\"></form>";
}
else {
echo "Message sent to Server!";
fputs($fp,$field_msg);
fclose($fp);
}
}
?>
...
Does anyone what may be wrong with this?
When user sends message from web i see the Server @ 10.0.0.8 showing me
a message dialog
---------------------
| Message received: |
---------------------
BUT I CAN'T SEE THE MESSAGE...
Sorry 4 long post. Thanks in advance.
----------------------------------
Henry - Argentina
http://www.quiquesistemas.com.ar
quique2001@data54.com
ICQ: 18048153