/**
*SimulationPostForUrlRequest
*@paramString $url
*@paramArray $post _data
*@returnBool|mixed
*/
functionRequest_post ($url=‘‘,$post _data=Array())
{
If(Empty($url) ||Empty($post _data)) {
return False;
}
$str="";
Foreach($post _dataAs$key=$val) {
$str.="$key=".UrlEncode($val)."&";
}
$post=Substr($str,0, -1);
$options=Array(
Curlopt_returntransfer=True,//Sets the information obtained in the form of a file stream, rather than directly outputting
Curlopt_header=False,//Whether to export header file information as a data stream when enabled
Curlopt_post=True,//When enabled, it sends a regularPOSTRequest, type is:application/x-www-form-urlencoded, just like the form submitted
Curlopt_postfields=$post,//After processing the pseudoPostPassing arrays
Curlopt_url=$url//You need to get theUrlAddress
);
$ch = curl_init (); //curl
Curl_setopt_array ( $ch , $options );
$data = curl_exec ( $ch );
curl_close ( $ch );
return $data ;
} /span>
Impersonate a post for a URL request