In php, the fsockopen function can simulate the user's access to some websites and also carry some common information. if the browser, IP address, post, get, and other data, next I will introduce you to you separately. if you want to use the fsockopen function... in php, the fsockopen function can simulate the user's access to some websites and also carry some common information. if the browser, IP address, post, get, and other data, next I will introduce you to you separately.
If you want to use the fsockopen function, you must set allow_url_fopen = On to enable in php. ini.
For Example, fsockopen () Example. the code is as follows:
n";} else { $out = "GET / HTTP/1.1rn"; $out.= "Host: www.example.comrn"; $out.= "Connection: Closernrn"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp);}?>
Forge post and post http requests (URLs) and obtain the returned values. the code is as follows:
Brief description: The second line of the code is your IP address or domain name, and the fourth line is the specific address of the page you want to POST. In this example, the content of fsock. php is as follows:
";echo "password:" . $_POST['password'];?>
// The result is username: demo password: hahaha.
The code for forging get and post and get methods is as follows: