function do_post_request($url, $data, $optional_headers = null){
echo "3333";
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
echo do_post_request("http://106.88.37.111:8402/sms.aspx","action=send&userid=12&account=账号&password=密码&mobile=18621113895&content=内容内容内容&sendTime=&extno=");
最方便好用的的 PHP 模拟上传函数
最新推荐文章于 2024-04-19 00:15:00 发布