function http_post($url,$data = null)
{
$cxContext = NULL;
if($data!=null)
{
$opts = array(
‘http‘=>array(
‘method‘=>"POST",
‘header‘=>"Content-type: application/x-www-form-urlencoded\r\n".
"Content-length:".strlen($data)."\r\n" .
"\r\n",
‘content‘ => $data,
)
);
$cxContext = stream_context_create($opts);
}
$output = file_get_contents($url, false, $cxContext);
return $output;
}
时间: 2024-10-09 12:31:16