1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > asp发送短信功能如何改成php的 有asp例子 求教

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

时间:2019-11-06 19:32:37

相关推荐

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

后端开发|php教程

nbsp,this,gt,protected,CURLOPT

后端开发-php教程

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

易语言一键装机源码,vscode动漫主题,ubuntu 免费,tomcat已经安,sqlite查询条件顺序,discuz 直播插件,为什么web前端用框架,制作爬虫犯法吗视频,php防止攻击,单品做seo,discuz建立两个网站,网页自动向下拉,android 界面模板下载lzw

If vercode > "" Then

email = "接口短信的用户账号"

SMS_PASSWORD = "接口短信的用户密码"

DescURL = "/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);

——解决思路———————-

ghost 源码,ubuntu如何配置桌面,app反爬虫策略,php @fopen(),酷排seolzw

<?php

class mycurl {

protected $_useragent = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;

protected $_url;

protected $_followlocation;

protected $_timeout;

protected $_maxRedirects;

protected $_cookieFileLocation = ./cookie.txt;

protected $_post;

protected $_postFields;

protected $_referer ="/api/send.asp";

protected $_session;

protected $_webpage;

protected $_includeHeader;

protected $_noBody;

protected $_status;

protected $_binaryTransfer;

public $authentication = 0;

public $auth_name= \;

public $auth_pass= \;

public function useAuth($use){

$this->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 = ul)

{

if($url != ul){

$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("/api/send.asp");

//一些上边的变量拼接,有用户名,密码,发送手机号

$m->setPost(Array("email"=> $email,

"Password"=> $SMS_PASSWORD,

"MsgContent"=> $MsgContent,

"mobileNumber"=> $mobileNumber,

"SendTime"=> $SendTime,

"SubNumber"=> $SubNumber

));

$m->createCurl();

?>

你看这样是否能用

文章网站php源码,ubuntu开机自动重启,tomcat程序员知识,深圳爬虫展,php tron 离线,seo年终总结与来年计划pptlzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。