Search results
fsockopen () example: <?php $fp = fsockopen ("www.w3schools.com", 80, $errno, $errstr, 20); if (!$fp) {echo "$errstr ($errno)<br>";} else {$out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.w3schools.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite ($fp, $out); while (!feof ($fp)) {echo fgets ($fp, 128); } fclose ($fp);}?>.
fsockopen ( string $hostname, int $port = -1, int &$error_code = null, string &$error_message = null, ? float $timeout = null): resource | false
Learn how to use the fsockopen () function to open a network connection to a server and send/receive data using the TCP/IP protocol. See the syntax, parameters, examples and quiz of the function.
The fsockopen() function opens an Internet or Unix domain socket connection. Syntax
10 sie 2024 · fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will return false
resource fsockopen ( string target [, int port [, int &errno [, string &errstr [, float timeout]]]] ) Initiates a socket connection to the resource specified by target. PHP supports targets in the Internet and Unix domains as described in Appendix O.