Answer the question
In order to leave comments, you need to log in
How to make requests through sockets and proxies to wss (websocket)?
Good day.
You need to connect to the server via wss and be sure to use a certain http proxy
, you can make a socks5 proxy, but you haven’t figured out how to fasten it.
I do like this:
$sp = stream_socket_client("proxy:ip", $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT , $context);
$write = "CONNECT host.com:443 HTTP/1.1\r\n";
$write .= "HOST: host.com\r\n";
$write .= "\r\n";
fwrite($sp, $write);
Answer the question
In order to leave comments, you need to log in
1. you need socks4 / socks5 / HTTP tunnel
2. you can't just put socks proxy in stream_socket_client. But if you really want to, then it's done like this - https://github.com/weheartwebsites/SOCKS5/blob/mas... I
suggest using a ready-made and proven websocket client https://github.com/ampp/websocket-client
that in proxy https://github.com/ampp/websocket-client/issues/24
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question