Copy CodeThe code is as follows:
Header ("content-type:text/html; Charset=utf8 ");
/*
* Submit Request
* @param $header Array need to configure the domain name and other header settings array ("Host:devzc.com");
* @param $data string required to submit the data ' user=xxx&qq=xxx&id=xxx&post=xxx ' ....
* @param $url String to submit the URL ' http://192.168.1.12/xxx/xxx/api/';
*/
function Curl_post ($header, $data, $url)
{
$ch = Curl_init ();
$res = curl_setopt ($ch, Curlopt_url, $url);
Var_dump ($res);
curl_setopt ($ch, Curlopt_ssl_verifyhost, FALSE);
curl_setopt ($ch, Curlopt_ssl_verifypeer, FALSE);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $data);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_httpheader, $header);
$result = curl_exec ($ch);
Curl_close ($ch);
if ($result = = NULL) {
return 0;
}
return $result;
}
$url = ' http://127.0.0.1 ';
$header = Array ("host:127.0.0.1",
"Content-type:application/x-www-form-urlencoded",
' Referer:http://127.0.0.1/toolindex.xhtml ',
' User-agent:mozilla/4.0 (compatible; MSIE. 0; Windows NT 6.1; trident/4.0; SLCC2;);
$data = ' Tools_id=1&env=gamma ';
echo "argv: $data
";
$ret = Curl_post ($header, $data, $url);
$utf 8 = iconv (' GB2312 ', ' Utf-8//ignore ', $ret);
Echo ' return:
'. NL2BR ($utf 8). '
';
?>
http://www.bkjia.com/PHPjc/633584.html www.bkjia.com true http://www.bkjia.com/PHPjc/633584.html techarticle Copy the code as follows:? header ("content-type:text/html; Charset=utf8 "); /* * Submit Request * @param $header array need to configure the domain name such as header settings Array ("Host:devzc.com") ...