title: Detect redirection of remote url with php
body: <p>I have a php page where it loads some predefined options and text boxes with html codes.<br>
  Later it posts data on a remote page. </p>
  
  <pre><code>&lt;img src="data:&lt;?php echo $captchaQuery['content_type'] ?&gt;;base64,&lt;?php echo $captcha ?&gt;" alt="Captcha" height="30" align="absbottom" id="msg_captcha" name="msg_captcha"&gt;
  &lt;input type="text" name="f_captcha" size="8" maxlength="5"&gt;
  &lt;input type="submit" value="SEND" class="btnorange"&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>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?  </p>
  
  <p>Target url for for submitting data  is : $baseurl . ?psean=. </p>
  
  <p>if there is an error ridirects to : $baseurl . ?psean= captcha was wrong</p>