To have cURL support, then php must be compiled --with-curl option.
To have sockets support, then php must be compiled with --enable-sockets option.
To have stream wrappers support for http, ftp ... in functions like fopen, file_get_contents ... then allow_url_fopen must be set to On in php.ini.
While most shared webhosting servers have all (or almost all) previous features enabled, some of them
may not have support for those features, because their optional status.
On the other hand streams are part of php core.
If somebody wants to make a verry portable(i think) php http client for example, not based on cURL,
socket, or wrappers(http) support, then, that can be done with:
$fp = stream_socket_client("tcp://example.com:80", $errno, $errstr);
fwrite($fp, "GET / HTTP/1.0\r\nHost: example.com\r\nAccept: */*\r\n\r\n");
using not a http stream wrapper but a stream transport wrapper(tcp) which is different.
I saw on my localhost that even when php.ini directive allow_url_fopen is set to Off,
I can make remote connection via stream_socket_client() using tcp transport.
My questions are:
1. Is there a way to block availability of core streams, except the possibility to disable functions like stream_socket_client or fsockopen in php.ini by hardcoding them like:
disable_functions = exec,passthru,shell_exec,stream_socket_client,fsockopen ...
???
2. Is the use of $fp = stream_socket_client('tcp://...',[...]);
the most portable solution
for making remote connections, that can be turned later in http/ftp... requests by connecting first to the right port(e.g 80) and using fwrite($fp, 'GET /...');
to send low level http/ftp queries
to the remote server?