Socket is a transmission protocol that provides asynchronous communication between client servers! Use the fsockopen () function to establish a socket connection. As mentioned above, cURL is a tool for connecting and communicating with various servers using various protocols. See the following section p
Socket is a transmission protocol that provides asynchronous communication between client servers! Use the fsockopen () function to establish a socket connection. As mentioned above, cURL is a tool for connecting and communicating with various servers using various protocols.
See the following php code:
\ N ";} else {$ out =" GET/HTTP/1.1 \ r \ n "; $ out. = "Host: $ host \ r \ n"; $ out. = "Connection: Close \ r \ n"; // fwrite () and fputs () write content fwrite ($ fp, $ out); // feof () test whether the file pointer ends while (! Feof ($ fp) {// fgets () or fread () echo fgets ($ fp, 128) ;}fclose ($ fp) ;}?>
The running result is as follows: