这是第一种。通过javascript页面加载完后,对表单采用 post方式提交给 第三方接口-----
echo <<<_END
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>正在转入支付页面......</title>
</head>
<body onLoad="javascript:document.E_FORM.submit()">
<p>正在转入支付页面.....</p>
<form method="post" name="E_FORM" action="https://Pay3.chinabank.com.cn/PayGate?encoding=UTF-8">
<input type="hidden" name="v_mid" value="$v_mid">
<input type="hidden" name="v_oid" value="$v_oid">
<input type="hidden" name="v_amount" value="$v_amount">
<input type="hidden" name="v_moneytype" value="$v_moneytype">
<input type="hidden" name="v_url" value="$v_url">
<input type="hidden" name="v_md5info" value="$v_md5info">
<input type="hidden" name="remark2" value="$remark2">
<input type="hidden" name="remark1" value="$remark1">
</form>
</body>
</html>
_END;
第二种传输方式是采用--curl post 来进行数据传输给服务器
<?php
$uri = "http://tanteng.duapp.com/test.php";
// 参数数组
$data = array (
'name' => 'tanteng'
// 'password' => 'password'
);
$ch = curl_init ();
// print_r($ch);
curl_setopt ( $ch, CURLOPT_URL, $uri );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
$return = curl_exec ( $ch );
curl_close ( $ch );
print_r($return);
接受php页面远程服务器:
<?php
if(isset($_POST['name'])){
if(!empty($_POST['name'])){
echo '您好,',$_POST['name'].'!';
}
}
?>