The PHP analog post submission data is file_get_contents, curl, and socket, and they can all be submitted via analog post for post data transfer.
File_get_contents Analog Post submission:
$arr =array (' http ' =>array (' method ' = ' POST ', ' content ' = ' name=wang&pwd=123′ ');
$result = file_get_contents ("www.wangzhiguang.com.cn", False,stream_context_create ($arr))
Http://dict.baidu.com/s?wd=%E6%B4%9B%E4%B8%BD%E8%AF%97+%E4%BD%A0%E7%9A%84%E9%80%89%E6%8B%A9+%E6%89%BE%E5%9B%9E %e8%87%aa%e4%bf%a1%e4%b8%8e%e9%aa%84%e5%82%b2
Curl Analog Post submission:
$arr = Array (
Curlopt_returntransfer = True,
Curlopt_header = False,
Curlopt_post = True,
Curlopt_postfields = = Array (' name ' = ' Wang ', ' pwd ' = ' 123′ ')
);
$ch = Curl_init ($url);
Curl_setopt_array ($ch, $arr);
$result = curl_exec ($ch);
Curl_close ($ch);
Socket to simulate post submission:
$url = "www.wangzhiguang.com.cn";
$host = 80;
$content = ' name=wang&pwd=123′;
$fp = Fsockopen ($content, $host, $errno, $ERRSTR);
$length = strlen ($content);
$header = <<
POST {$url} http/1.1
Host: {$host}
content-type:application/x-www-form-urlencoded
Content-length: {$length}
Connection:close
{$content}
HEADER;
Fwrite ($fp, $header);
while (!feof ($fp)) {
$result. = Fread ($FP, 512);
}
http://dict.baidu.com/s?wd=%E3%80%90%E5%88%98%E5%BF%83%E8%AF%AD%E6%B8%85%E6%9C%9D%E5%AE%AB%E5%BB%B7%E4%B8%B0% e8%83%b8%e8%8c%b6+100%25%e4%b8%b0%e8%83%b8%e6%88%90%e5%8a%9f+%e4%b8%80%e4%b8%aa%e6%9c%88%e5%a2%9e%e5%8a%a0%e4% b8%80%e4%b8%aa%e7%bd%a9%e6%9d%af%e3%80%91
$result = Explode ("\r\n\r\n", $result, 2);
Blank line between Connection:close and post data
It is best to return the value $result you can see the sending status.
PHP analog post submission data three ways