Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Delphi & PHP programming


Message #1 by "Quique" <quique2001@d...> on Mon, 1 Apr 2002 18:50:06
I don't know much about Delphi, but I did notice something:

you're echoing "Message sent to Server!" without ever checking to see if
that's actually the case.  You're actually outputting that to the web user
before you even send the message!  For all you know, fputs is throwing some
horrible error and crashing, but your end user can't tell!

ALWAYS ALWAYS ALWAYS output success/error messages AFTER the operation that
they're describing, and ALWAYS ALWAYS ALWAYS put your money where your mouth
is; check the return values that validate your statements.

Otherwise, you're output is writing checks that your script can't cash.

(my god, I've always wanted to be able to use that cliche in a post!)

fputs is an alias for fwrite.  This function returns the number of bytes
written, or -1 if error.  Check the return value for the function and see if
you're sending things correctly on the php side of things.

What you could also do is open a telnet session to 10.0.0.8 4250, and
manually type in the string that you're attempting to send with PHP.  Check
out what happens on both sides of things when you do that.  Compare it to
what happens when you send the same string using PHP.


Take care,

Nik


  Return to Index