21,887
社区成员
发帖
与我相关
我的任务
分享
<?php
//提供的salt,cid,phoneno,URL
$salt = "";
$cid = "";
$phoneno = "";
$URL= "";
//获取的两个电话号码
$tel1 = $_POST['tel1'];
$tel2 = $_POST['tel2'];
$validate = strtoupper(md5($cid.$phoneno.$tel1.$tel2.$salt));
$message = $cid.','.$phoneno.','.$tel1.','.$tel2.','.$validate;
$hosturl = "http://".$_SERVER['HTTP_HOST'];
//验证是否非法提交,方法自己写
if(!strstr($_SERVER['HTTP_REFERER'],$hosturl)){
print("<script>history.back()</script>");
}
//虚拟提交
$post_data['message'] = $message;
$post_data['submit'] = "submit";
$referrer="";
// parsing the given URL
$URL_Info=parse_url($URL);
// Building referrer
if($referrer=="") // if not given use this script as referrer
$referrer=$_SERVER["SCRIPT_URI"];
// making string from $data
foreach($post_data as $key=>$value)
$values[]="$key=".urlencode($value);
$data_string=implode("&",$values);
// Find out which port is needed - if not given use standard (=80)
if(!isset($URL_Info["port"]))
$URL_Info["port"]=80;
// building POST-request:
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host: ".$URL_Info["host"]."\n";
$request.="Referer: $referrer\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="Content-length: ".strlen($data_string)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data_string."\n";
$fp = fsockopen($URL_Info["host"],$URL_Info["port"]);
fputs($fp, $request);
while(!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
$result = substr($result,strlen($result)-3,strlen($result));
if ($result=="400") {
print $result."呼叫成功";
} else {
print $result."呼叫失败";
}
?>
strUrl = "..."
XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
XMLHTTP.Open "POST", strUrl, False
XMLHTTP.setRequestHeader"Content-Type", "application/x-www-form-urlencoded"
XMLHTTP.send"..."
Response.Write XMLHTTP.responseText
<%
Function GetBody(weburl)
'创建对象
Dim ObjXMLHTTP
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
'请求文件,以异步形式
ObjXMLHTTP.Open "GET",weburl,False
ObjXMLHTTP.send
While ObjXMLHTTP.readyState <> 4
ObjXMLHTTP.waitForResponse 1000
Wend
'得到结果
GetBody=ObjXMLHTTP.responseBody
'释放对象
Set ObjXMLHTTP=Nothing
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function