fsockopen access URL
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 08:49:21
Original
1284 people have browsed it
学习自alipay
- function gateway($url, $time_out="60") {
- $urlinfo = parse_url($url);
- $errno = "";
- $errstr = "";
- $transports = "";
- if ($urlinfo['scheme'] == "https") {
- $transports = "ssl://";
- $urlinfo['port'] = "443";
- }else{
- $transports = "tcp://";
- $urlinfo['port'] = "80";
- }
-
- $fp = @fsockopen($transports.$urlinfo['host'], $urlinfo['port'], $errno, $errstr, $time_out);
- if (!$fp) {
- die("ERROR: $errno - $errstr
n");
- }else{
- fputs($fp, "POST ".$urlinfo['path']." HTTP/1.1rn");
- fputs($fp, "Host: ".$urlinfo['host']."rn");
- fputs($fp, "Content-type: application/x-www-form-urlencodedrn");
- fputs($fp, "Content-length: ".strlen($urlinfo['query'])."rn");
- fputs($fp, "Connection: closernrn");
- fputs($fp, $urlinfo['query']."rnrn");
- while(!feof($fp)) {
- $info[]=@fgets($fp, 1024);
- }
- fclose($fp);
- $info = implode(",", $info);
-
- var_dump($info);
- }
- }
复制代码
|
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-21 13:39:34
-
2025-03-21 13:38:34
-
2025-03-21 13:37:19
-
2025-03-21 13:35:24
-
2025-03-21 13:34:32