Use php's fsocket to simulate get submission and simulate post submission form
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 08:45:18
Original
1031 people have browsed it
- //fsocket模拟post提交
- $purl = "http://www.baidu.com";
- print_r(parse_url($url));
- sock_post($purl, "parm=ping");
- //fsocket模拟get提交
- function sock_get($url, $query)
- {
- $info = parse_url($url);
- $fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
- $head = "GET " . $info['path'] . "?" . $info["query"] . " HTTP/1.0rn";
- $head .= "Host: " . $info['host'] . "rn";
- $head .= "rn";
- $write = fputs($fp, $head);
- while (!feof($fp)) {
- $line = fread($fp, 4096);
- echo $line;
- }
- }
- sock_post($purl, "parm=ping");
- function sock_post($url, $query)
- {
- $info = parse_url($url);
- $fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
- $head = "POST " . $info['path'] . "?" . $info["query"] . " HTTP/1.0rn";
- $head .= "Host: " . $info['host'] . "rn";
- $head .= "Referer: http://" . $info['host'] . $info['path'] . "rn";
- $head .= "Content-type: application/x-www-form-urlencodedrn";
- $head .= "Content-Length: " . strlen(trim($query)) . "rn";
- $head .= "rn";
- $head .= trim($query);
- $write = fputs($fp, $head);
- while (!feof($fp)) {
- $line = fread($fp, 4096);
- echo $line;
- }
- }
- ?>
复制代码
|
php, fsocket, post
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11
Latest Issues
-
2025-03-19 14:08:27
-
2025-03-19 14:07:29
-
2025-03-19 14:06:28
-
2025-03-19 14:05:31
-
2025-03-19 14:04:29