3
我有一個HTML表單,被提交到一個PHP頁面。 PHP頁面需要驗證驗證碼,然後將表單值傳遞給JSP頁面。我無法控制JSP頁面。 Captcha正在精美地工作。在我的PHP頁面中有一些東西正在迷失,就像它在JSP頁面上加載信息時一樣,目標頁面的CSS和標頭沒有加載,表單數據也沒有被傳遞。我無法訪問JSP頁面。有任何想法嗎?通過PHP/Curl將HTML表單傳遞給JSP頁面...通過不發生
BTW,驗證碼驗證工作的罰款和HTML工作正常,如果我直接傳遞給JSP頁面:
<?php
require_once('recaptchalib.php');
$privatekey = "privatekeyhere";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("<p align='center'>The reCAPTCHA wasn't entered correctly. Please go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")</p>");
} else {
$ipaddress = $_SERVER["REMOTE_ADDR"];
$fname = $_POST['fname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$h = curl_init();
curl_setopt($h, CURLOPT_URL, "//remote JSP page");
curl_setopt($h, CURLOPT_HEADER, true);
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_POSTFIELDS, array(
'fname' => '$fname',
'address' => '$address',
'city' => '$city',
'state' => '$state',
'zip' => '$zip',
'phone' => '$phone',
'email' => '$email',
));
curl_setopt($h, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($h);
echo $result;
}
?>