<?php
header('Content-Type: text/html; charset=UTF-8');
error_reporting(0);
$api='http://f.xxxx.com/post.asp';//
$name=trim(strip_tags($_POST['name'])).trim(strip_tags($_POST['xingming']));
$phone=trim(strip_tags($_POST['phone'])).trim(strip_tags($_POST['tel']));
$text=trim(strip_tags($_POST['msg'])).trim(strip_tags($_POST['age']));
$vincent=curl_post($api,$name,$phone,$text);
echo $vincent;
//echo 'posttest'.$name.$phone.$text;
//获取IP
function get_client_ip() {
if (getenv ( "HTTP_CLIENT_IP" ) && strcasecmp ( getenv ( "HTTP_CLIENT_IP" ), "unknown" ))
$ip = getenv ( "HTTP_CLIENT_IP" );
else if (getenv ( "HTTP_X_FORWARDED_FOR" ) && strcasecmp ( getenv ( "HTTP_X_FORWARDED_FOR" ), "unknown" ))
$ip = getenv ( "HTTP_X_FORWARDED_FOR" );
else if (getenv ( "REMOTE_ADDR" ) && strcasecmp ( getenv ( "REMOTE_ADDR" ), "unknown" ))
$ip = getenv ( "REMOTE_ADDR" );
else if (isset ( $_SERVER ['REMOTE_ADDR'] ) && $_SERVER ['REMOTE_ADDR'] && strcasecmp ( $_SERVER ['REMOTE_ADDR'], "unknown" ))
$ip = $_SERVER ['REMOTE_ADDR'];
else
$ip = "unknown";
return ($ip);
}
//转发提交
function curl_post($api,$name,$phone,$msg){
if($phone&&$api){
if(function_exists('curl_init')){
$ip=get_client_ip();
$curlPost = 'xingming='.$name.'&shoujihao='.$phone.'&xx1='.urlencode($msg).'&url1='.$ip.'&cls=9';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}else{
exit('提交失败!');
}
}
}
?>
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询