我有一个表单,当提交发布到远程网址时使用curl表单发布到它自己并且一切正常但我知道需要将表单数据发送到页面,以便从正常代码中分割表单代码工作。
我当前的代码是。
<?php
if (!empty($_POST['btnApply_x'])) {
$post['AffiliateID'] = '0000';
$post['AffiliatePW'] = '00000';
$post['ReqMode'] = 'TEST';
$post['ReqLoanAmount'] = $_POST['slidval'];
$post['ReqConsent'] = 1;
$post['ReqIPAddress'] = $_SERVER['REMOTE_ADDR'];
$post['AppTitle'] = $_POST['ddlTitle'];
$post['AppFirstName'] = $_POST['txtFirstname'];
$post['AppLastName'] = $_POST['txtSurname'];
$post['AppEmail'] = $_POST['txtEmail'];
$post['AppDOBDay'] = $_POST['ddlDay'];
$post['AppDOBMonth'] = $_POST['ddlMonth'];
$post['AppDOBYear'] = $_POST['ddlYear'];
// $post['date_of_birth'] = $_POST['ddlDay'] . '/' . $_POST['ddlMonth'] . '/' . $_POST['ddlYear'];
$post['AppHomePhone'] = $_POST['txtHomePhone'];
$post['AppWorkPhone'] = $_POST['txtWorkPhone'];
$post['AppMobilePhone'] = $_POST['txtMobile'];
// $post['BankDebitCard'] = $_POST['ddlDMPlan'];
$post['BankDebitCard'] = $_POST['ddlPrimaryDebitCard'];
$post['AppHomeStatus'] = $_POST['ddlHomeType'];
$post['btnnext_x'] = $_POST['btnnext_x'];
$post['btnnext_y'] = $_POST['btnnext_y'];
$post['AppHouseNumber'] = $_POST['txtHouseNumber'];
$post['AppStreet'] = $_POST['txtStreetName'];
$post['AppTown'] = $_POST['txtTownCity'];
$post['AppPostCode'] = $_POST['txtPostCode'];
$post['AppCounty'] = $_POST['ddlCounty'];
$post['AppAddressYears'] = $_POST['ddlTimeAtAddress'];
$post['EmpIncomeType'] = $_POST['ddlPrimaryIncome'];
$post['EmpEmployerName'] = $_POST['txtEmployerName'];
$post['EmpTimeAtEmployer'] = $_POST['ddlTimeWithEmployer'];
$post['EmpNetMonthlyPay'] = $_POST['txtAfterTax']; //needs changing
// $post['following_pay_day'] = $_POST['ddlFollowingPayDay'] . '/' . $_POST['ddlFollowingPayMonth'] . '/' . $_POST['ddlFollowingPayYear'];
$post['EmpPayFrequency'] = $_POST['ddlPayFrequency'];
$post['EmpDirectPayment'] = $_POST['ddlPaidIntoBankAccount']; //change this
// $post['next_pay_day'] = $_POST['ddlNextPayDay'] . '/' . $_POST['ddlNextPayMonth'] . '/' . $_POST['ddlNextPayYear'];
$post['EmpNextPayDay'] = $_POST['ddlNextPayDay'];
$post['EmpNextPayMonth'] = $_POST['ddlNextPayMonth'];
$post['EmpNextPayYear'] = $_POST['ddlNextPayYear'];
$post['EmpFollowingPayDay'] = $_POST['ddlFollowingPayDay'];
$post['EmpFollowingPayMonth'] = $_POST['ddlFollowingPayMonth'];
$post['EmpFollowingPayYear'] = $_POST['ddlFollowingPayYear'];
$post['EmpNINumber'] = $_POST['txtNationalInsurance'];
$post['BankAccount'] = $_POST['txtAccountNumber'];
$post['BankSortcode'] = $_POST['txtSortCode'];
// $post['chkTerms'] = $_POST['chkTerms'];
$post['ReqMarketingOptIn'] = $_POST['chkMarketing'];
// rint_r($post);
$post['ReqAgent'] = '';
$post['ReqDomain'] = '';
$post['AppAddressMonths'] = 1;
$post['ReqTotalTimeout'] = 60;
$post['ReqLenderTimeout'] = 60;
$postvars = str_replace('&', '&', (http_build_query($post)));
$ch = curl_init('https://000.co.uk/requestservice.asmx/Requestv4');
curl_setopt($ch, CURLOPT_POST , 1);
curl_setopt($ch, CURLOPT_POSTFIELDS , $postvars);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER , 0); // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_VERBOSE , 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , 1); // RETURN THE CONTENTS OF THE CALL
$Rec_Data = curl_exec($ch);
$redirect = cut_str($Rec_Data, '<RedirectURL>', '</RedirectURL>');
if (empty($redirect)) {
echo $Rec_Data; //change this line to reflect any changes / error messages to be displayed
} else {
header('location:' . $redirect);
}
}
function cut_str($str, $left, $right)
{
$str = substr (stristr ($str, $left), strlen ($left));
$leftLen = strlen (stristr ($str, $right));
$leftLen = $leftLen ? - ($leftLen) : strlen ($str);
$str = substr ($str, 0, $leftLen);
return $str;
}
?>
<form target="_blank" action='' method="POST" >
<input type='hidden' value='' name='AffiliateID' /><input type='hidden' value='' name='AffiliatePW' /><input type='hidden' value='' name='ReqMode' /><input type='hidden' value='' name='ReqTotalTimeout' /><input type='hidden' value='' name='ReqLenderTimeout' /><input type='hidden' value='' name='ReqLoanAmount' /><input type='hidden' value='' name='AppTitle' /><input type='hidden' value='' name='AppFirstName' /><input type='hidden' value='' name='AppLastName' /><input type='hidden' value='' name='AppEmail' /><input type='hidden' value='' name='AppDOBDay' /><input type='hidden' value='' name='AppDOBMonth' /><input type='hidden' value='' name='AppDOBYear' /><input type='hidden' value='' name='AppHomePhone' /><input type='hidden' value='' name='AppWorkPhone' /><input type='hidden' value='' name='AppMobilePhone' /><input type='hidden' value='' name='AppPostCode' /><input type='hidden' value='' name='AppHouseNumber' /><input type='hidden' value='' name='AppStreet' /><input type='hidden' value='' name='AppTown' /><input type='hidden' value='' name='AppCounty' /><input type='hidden' value='' name='EmpIncomeType' /><input type='hidden' value='' name='EmpEmployerName' /><input type='hidden' value='' name='EmpTimeAtEmployer' /><input type='hidden' value='' name='EmpNetMonthlyPay' /><input type='hidden' value='' name='EmpPayFrequency' /><input type='hidden' value='' name='EmpDirectPayment' /><input type='hidden' value='' name='EmpNextPayDay' /><input type='hidden' value='' name='EmpNextPayMonth' /><input type='hidden' value='' name='EmpNextPayYear' /><input type='hidden' value='' name='EmpFollowingPayDay' /><input type='hidden' value='' name='EmpFollowingPayMonth' /><input type='hidden' value='' name='EmpFollowingPayYear' /><input type='hidden' value='' name='EmpNINumber' /><input type='hidden' value='' name='BankAccount' /><input type='hidden' value='' name='BankSortcode' /><input type='hidden' value='' name='BankDebitCard' /><input type='hidden' value='' name='AppAddressYears' /><input type='hidden' value='' name='AppAddressMonths' /><input type='hidden' value='' name='AppHomeStatus' /><input type='hidden' value='' name='ReqConsent' /><input type='hidden' value='' name='ReqIPAddress' /><input type='hidden' value='' name='ReqAgent' /><input type='hidden' value='' name='ReqMarketingOptIn' /><input type='hidden' value='' name='ReqDomain' />
<input type="submit" value="Invoke" class="button">
我需要做的是只需要一张表单和一张表格的页面