0

Is it possible to send raw tcp data stream using curl with php? I know that fsockopen/fputs is better choice for such sending, and surely I use them when its possible. But on some servers socket functions are disabled, and curl is enabled. So in such cases it will be very comfortably use curl, of course if its possible at all. For example I need

$fp = fsockopen($my_ip, $my_port);
fwrite($fp, "test string");

I cant use fsockopen, as it's disabled by server config. Any tips to do it with curl?

1
  • cURL is for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. It will not support any communication with non-URL syntax Commented Apr 4, 2013 at 12:05

1 Answer 1

1

You could use the Telnet option of curl as is done here: Proper and fast way to TELNET in PHP. Sockets are damn slow or how to TELNET with PHP cURL?

So you won't drag along the http or ftp or whatever protocol.

After that you may try for yourself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.