as a continue of rembert:
so you should always use strlen($cmd) as third parameter if you use fsockopen -- because nearly everything you write e.g. in telnet or ssh has 2 or more "words".
(proud user of php4)
grz stalker
![]() | fputs![]()
stalker at ruun dot de
15-Sep-2005 03:08
as a continue of rembert:
rembert at floating-point dot nl
21-Nov-2002 08:03
Adding to Adam (Nedstat):
yvan dot rivard at cesart dot com
18-Apr-2001 05:52
This might seem silly for experienced users, but this bugged me for about two hours (searching and trying to debug the damn thing).
08-Oct-2000 03:07
You can use here-documents in PHP but not for printing to a file pointer.
Doug at Here dot Com
01-Jul-2000 08:46
The way I understand fputs (which is purported as an alias to fwrite which can be "Binary Safe")...
adam at nedstat dot nl
16-Jun-1999 11:19
A note about including length: if you are writing binary data you should *always* specify the data's length. The reason is that the operating system has a special character to denote end of *strings*, but not for binary data. Binary data can be anything, so you can't very well reserve an end-of-data character. So the reason why writing binary data without specifying it's length can truncate it is that the only thing the system has to go on (without writing the entire contents of memory starting at the variable's address) is the end-of-string character, which could very well appear randomly in the middle of your set of binary data. The reason that length() could have worked on the variable is that it is implemented in C as sizeof(), which actually fetches the size of the memory chunk associated with the variable, but this is not advisable because sizeof() can also return the size of the *pointer* to the variable if you're not careful (ie, passing it by reference into a second function). In C it's best to keep track of size of the data you are accumulating as you accumlate it, so probably in PHP, too.
bschuetz at affinity dot net
23-Dec-1998 11:30
Length is required if you are writing out a lot of data. For instance, if you are base64 decoding an email attachment and writing it out to a file you have to specify the length if the file is over a certian size or else the binary data will be corrupt.
| ![]() |