您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

asp发送短信功能如何改成php的,有asp例子,求教

2024/6/30 19:31:27发布27次查看
asp发送短信功能怎么改成php的,有asp例子,求教
if vercode > then
email = 接口短信的用户账号
sms_password = 接口短信的用户密码
descurl = http://www.xxxx.com.cn/api/send.asp //接口地址
set objhttp = server.createobject(msxml2.xmlhttp)
call objhttp.open(post, descurl, false)
postdata = email=+email+&password=+sms_password+&msgcontent=+((msgcontent))+&mobilenumber=+ m +&sendtime=+sendtime+&subnumber=+ subnumber //一些上边的变量拼接,有用户名,密码,发送手机号等
response.write postdata
call objhttp.setrequestheader(content-type,text/html; charset=uft-8)
call objhttp.open(get,descurl & ? & postdata, false)
call objhttp.send()
end if
这是asp的写法,有点别扭。 要换成php怎么写啊?先谢谢了!
------解决思路----------------------
用curl类似的
------解决思路----------------------
file_get_contents($url);
------解决思路----------------------
authentication = 0;
if($use == true) $this->authentication = 1;
}
public function setname($name){
$this->auth_name = $name;
}
public function setpass($pass){
$this->auth_pass = $pass;
}
public function __construct($url,$followlocation = true,$timeout = 30,$maxredirecs = 4,$binarytransfer = false,$includeheader = false,$nobody = false)
{
$this->_url = $url;
$this->_followlocation = $followlocation;
$this->_timeout = $timeout;
$this->_maxredirects = $maxredirecs;
$this->_nobody = $nobody;
$this->_includeheader = $includeheader;
$this->_binarytransfer = $binarytransfer;
$this->_cookiefilelocation = dirname(__file__).'/cookie.txt';
}
public function setreferer($referer){
$this->_referer = $referer;
}
public function setcookifilelocation($path)
{
$this->_cookiefilelocation = $path;
}
public function setpost ($postfields)
{
$this->_post = true;
$this->_postfields = $postfields;
}
public function setuseragent($useragent)
{
$this->_useragent = $useragent;
}
public function createcurl($url = 'nul')
{
if($url != 'nul'){
$this->_url = $url;
}
$s = curl_init();
curl_setopt($s,curlopt_url,$this->_url);
curl_setopt($s,curlopt_httpheader,array('expect:'));
curl_setopt($s,curlopt_timeout,$this->_timeout);
curl_setopt($s,curlopt_maxredirs,$this->_maxredirects);
curl_setopt($s,curlopt_returntransfer,true);
curl_setopt($s,curlopt_followlocation,$this->_followlocation);
curl_setopt($s,curlopt_cookiejar,$this->_cookiefilelocation);
curl_setopt($s,curlopt_cookiefile,$this->_cookiefilelocation);
if($this->authentication == 1){
curl_setopt($s, curlopt_userpwd, $this->auth_name.':'.$this->auth_pass);
}
if($this->_post)
{
curl_setopt($s,curlopt_post,true);
curl_setopt($s,curlopt_postfields,$this->_postfields);
}
if($this->_includeheader)
{
curl_setopt($s,curlopt_header,true);
}
if($this->_nobody)
{
curl_setopt($s,curlopt_nobody,true);
}
/*
if($this->_binary)
{
curl_setopt($s,curlopt_binarytransfer,true);
}
*/
curl_setopt($s,curlopt_useragent,$this->_useragent);
curl_setopt($s,curlopt_referer,$this->_referer);
$this->_webpage = curl_exec($s);
$this->_status = curl_getinfo($s,curlinfo_http_code);
curl_close($s);
}
public function gethttpstatus()
{
return $this->_status;
}
public function __tostring(){
return $this->_webpage;
}
}
$m=new mycurl(http://www.xxxx.com.cn/api/send.asp);
//一些上边的变量拼接,有用户名,密码,发送手机号
$m->setpost(array(email=> $email,
password=> $sms_password,
msgcontent=> $msgcontent,
mobilenumber=> $mobilenumber,
sendtime=> $sendtime,
subnumber=> $subnumber
));
$m->createcurl();
?>
你看这样是否能用
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product