Forum Moderators: coopster
Have you read through this?
[php.net...]
fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fputs(), fclose(), and feof()).
I know how to use HTTP POST and GET methods using fsockopen() but I am clueless on this one.
First of all is
it possible to do this without a program at the other end
listening to my program? Also can it be done over TCP
using which port?
No. There has to be some process that listens for connections to the port you are using.
Unless you specify to use a unix socket in which case you could only connect to some local socket or explicitly specify the ud protocol fsockopen will use the tcp protocol to connect to the host. The port will depend on which service you want to use.
Why not use the ftp_* functions? Writing your own ftp client using fsockopen is not as trivial as talking HTTP to a webserver. Since most ftp servers will only accept passive ftp you would need to parse the string returned by the PASV [cr.yp.to] command and make a second connection using the ip and port number specified by the server.
Andreas