Resource fsockopen ( string $hostname
[, int $port
=-1 [, int &$errno
[, string &$errstr
[, C16>float $timeout
= Ini_get ("default_socket_timeout") ]]
Parameters
-
-
hostname
-
-
If OpenSSL is installed, then you should probably add the Access Protocol ssl:// or tls://to your host name address, so that you can connect to the remote host using TCP/IP protocol-based SSL or TLS.
-
-
port
-
-
Port number. If you pass a-1 to this parameter, you do not use a port, such as unix://.
-
-
errno
-
-
If this parameter is passed, holds the system level error number is occurred in the System-level Connect () call.
If errno
the return value is 0, and the return value of this function FALSE
is, then this indicates that the error occurred before the socket connection (Connect ()) call, The most likely cause of a connection failure is an error occurred while initializing the socket.
-
-
errstr
-
-
The error message is returned as a string of information.
-
-
timeout
-
-
Sets the time frame for the connection, in seconds. &NBSP,
lg: ww.php
$fp = Fsockopen ($_server[' HOST '],80), if (! $fp) {}else{$param = array (' name ' = = ' fdipzone ', ' gender ' = ' Man ', ' photo ' = file_get_contents (' photo.jpg ')); $data = Http_build_query ($param); $out = "Post/api/im-wa/new http/1.1\r\n"; Analog POST request $out. = "host:www.example.com\r\n"; $out. = "content-type:application/x-www-form-urlencoded\r\n";//post data $out. = "Content-length:". Strlen ($data). " \ r \ n "; The length of the//post data $out. =" connection:close\r\n\r\n ";//long connection close $out. = $data; Pass the Post data stream_set_blocking ($FP, true); Stream_set_timeout ($fp, 1); Fwrite ($fp, $out); Usleep (1000);
Fclose ($FP);}
wa.php
file_put_contents (' 1.txt ', Json_encode ($_post));
PHP implements asynchronous processing