Reputation: 315
I have a php page where it loads some predefined options and text boxes with html codes.
Later it posts data on a remote page.
<img src="data:<?php echo $captchaQuery['content_type'] ?>;base64,<?php echo $captcha ?>" alt="Captcha" height="30" align="absbottom" id="msg_captcha" name="msg_captcha">
<input type="text" name="f_captcha" size="8" maxlength="5">
<input type="submit" value="SEND" class="btnorange">
Everything works fine most of the time including remote captcha verification. When I press send button the page submits to remote url and reloads the php page.
My question is, 'when user puts wrong data in the text box the remote site redirects to another page, how can i also grab that redirected link and redirect user to that page rather than reloading my php?
Target url for for submitting data is : $baseurl . ?psean=.
if there is an error ridirects to : $baseurl . ?psean= captcha was wrong
Upvotes: 2
Views: 3370
Reputation:
See if the server sends redirect location in response headers
$url = "http://www.fb.com";
$headers = get_headers($url, 1);
if(!empty($headers['Location'])) {
$location = (array) $headers['Location'];
header('Location:' . end($location));
}
Upvotes: 4