To have cURL support, you need to compile php -with-curl.
For socket support, php must be compiled with the --enable-sockets option.
In order to have stream support for http, ftp ... in functions like fopen, file_get_contents ..., then allow_url_fopen must be set to On in php.ini.
Although most shared web hosting servers have all (or almost all) of the previous functions, some of them
may not have support for these functions because of their optional status.
Threads, on the other hand, are part of the php core.
If someone wants to make verry a portable (I think) php http client, for example, not based on cURL, socket or shell (http), then this 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 the wrapper of the http stream, but the wrapper of the transport stream (tcp), which is different.
I saw on my local host that even if the php.ini directive allow_url_fopen is set to Off, I can make a remote connection via stream_socket_client () using tcp transport.
My questions:
1. Is there a way to block the availability of main streams, with the exception of the ability to disable functions such as stream_socket_client or fsockopen in php.ini by hard-coding them, for example:
disable_functions = exec,passthru,shell_exec,stream_socket_client,fsockopen ...
???
2. $fp = stream_socket_client('tcp://...',[...]);
, http/ftp... , (, 80) fwrite($fp, 'GET /...'); HTTP/ftp
?