如果有人可以解释如何做到这一点或者在哪里可以找到这方面的教程,我需要帮助将 html 表单内容转发到公共 http 服务!
我制作了我的表格,如下所示:
<span class="text"> <input class="text" type="text" name="First" value="First" ></span>
<span class="text"> <input class="text" type="text" name="Last" value="Last" ></span>
<span class="text"><input type="text" value="Email" /></span>
<input class="btn-submit" type="submit" value="Submit" />
我得到了以下代码来转发输入:
$.ajax({
url: 'https://www.saddleback.com/Services/Subscription/Subscription/Save/' + subscriptionId,
data: {
'firstName': firstName,
'firstName': firstName,
'lastName': lastName,
'email': email,
'redirectToUrl': redirectToUrl,
'redirectFailureToUrl': redirectFailureToUrl
},
type: "post",
cache: false,
dataType: "text",
success: function (message) {
$('.subscriptionWarning').append("<span id=''litStatus''>" + message + "</span>");
},
error: function (xhr, ajaxOptions, thrownError) {
$('.subscriptionWarning').append("<span id=''litStatus''>Error encountered while saving subscription.</span>");
}
});
我需要转发到的 ID 是 23
感谢您的帮助,如果我的问题措辞错误,我们深表歉意。
<span class="text"> <input class="text" type="text" name="firstName" value="First" ></span>
<span class="text"> <input class="text" type="text" name="lastName" value="Last" ></span>
<span class="text"><input type="text" name="email" value="Email" /></span>
<input class="btn-submit" type="submit" value="Submit" />
$fname = $_GET['firstName'];
$lname = $_GET['lastName'];
$email = $_GET['email'];
$h = curl_init();
curl_setopt($h, CURLOPT_URL, "http://profile.purposedriven.com/managesubscriptionssimple.aspx");
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_POSTFIELDS, array(
'name' => 'yes',
'comment' => 'no'
));
curl_setopt($h, CURLOPT_HEADER, false);
curl_setopt($h, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($h);
echo $result;
这就是我的代码现在的样子。