This commit is contained in:
zhenjiang.dou 2016-12-28 16:38:27 +08:00
parent 154acdaa91
commit a8e5cc44a2
6 changed files with 62 additions and 3 deletions

View file

@ -6,4 +6,22 @@
$rooturl = $_SERVER['HTTP_HOST'];
$domain = preg_replace('/^www\./', '', $rooturl);
$static_release = "2016122717430333";
?>
function curlrequest($url, $data, $method="post") {
$ch = curl_init(); // 初始化CURL句柄
curl_setopt($ch, CURLOPT_URL, $url); // 设置请求的URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // 设为TRUE把curl_exec()结果转化为字串,而不是直接输出
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); // 设置请求方式
curl_setopt($ch, CURLOPT_REFERER,$url); // 构造来路
curl_setopt($ch, CURLOPT_HTTPHEADER,array("X-HTTP-Method-Override: $method")); // 设置HTTP头信息
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // 设置提交的字符串
$document = curl_exec($ch); // 执行预定义的CURL
if(!curl_errno($ch)) {
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
} else {
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
// $document=preg_replace("/[\t\n\r]+/","",$document);
return $document;
}

27
post.php Normal file
View file

@ -0,0 +1,27 @@
<?php
function curlrequest($url,$data,$method="post"){
$ch = curl_init(); // 初始化CURL句柄
curl_setopt($ch, CURLOPT_URL, $url); // 设置请求的URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // 设为TRUE把curl_exec()结果转化为字串,而不是直接输出
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); // 设置请求方式
curl_setopt($ch, CURLOPT_REFERER,$url); // 构造来路
curl_setopt($ch, CURLOPT_HTTPHEADER,array("X-HTTP-Method-Override: $method"));//设置HTTP头信息
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // 设置提交的字符串
$document = curl_exec($ch); // 执行预定义的CURL
if(!curl_errno($ch)) {
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
} else {
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
return $document;
}
$url = 'http://order.uiisc.com/register.php';
$data = "request from put method";
$return = curlrequest($url, $data, "post");
var_dump($return);exit;
?>

11
remote_reg.php Normal file
View file

@ -0,0 +1,11 @@
<?php
require_once ("core.php");
// $domain = "uiisc.com";
$post_data = $_POST;
print_r($post_data);
$data = file_get_contents("php://input");
$url = "http://order.".$domain."/register.php";
// $data = $post_data;
$return = curlrequest("http://".$domain."/test.php", $data, "post");
var_dump($return);exit;

BIN
resources/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

View file

@ -36,7 +36,7 @@
</p></h3>
</div>-->
<div class="panel-body">
<form class="form-horizontal" role="form" method=post action="https://order.<?=$domain?>/register.php">
<form class="form-horizontal" role="form" method=post action="//order.<?=$domain?>/register.php"><!--remote_reg.php-->
<input type="hidden" name="plan_name" value="free webhosting">
<div class="form-group">
<label for="inputUsername" class="col-sm-4 control-label" data-i18n="username">Username</label>
@ -84,7 +84,7 @@
<div class="form-group">
<label for="inputID" class="col-sm-4 control-label" data-i18n="security_code">Security Code</label>
<div class="col-sm-5">
<img width="90px" height="25px" src="https://order.<?=$domain?>/image.php?id=<?=$security_id?>">
<img width="90px" height="25px" src="//order.<?=$domain?>/image.php?id=<?=$security_id?>">
<input type="hidden" name="id" class="form-control" id="inputID" placeholder="ID" value="<?=$security_id?>">
</div>
</div>

3
test.php Normal file
View file

@ -0,0 +1,3 @@
<?php
print_r($_POST);
?>