title: Using PHP CURL to post data to external URL and redirect
body: <p>Here's my scenario.
  I have an external URL : <a href="https://staging.mead.com.ph/login/sso" rel="nofollow">https://staging.mead.com.ph/login/sso</a>
  Now I have to post data to that URL, assuming like the one below : </p>
  
  <ol>
  <li>Name</li>
  <li>Type</li>
  <li>Mobile Num</li>
  </ol>
  
  <p>Now, after posting I have to be redirected to the
  [redirect_url] inside curl_getinfo(). [redirect_url] has the following value : <strong><a href="https://staging.mead.com.ph/login/key=abcde" rel="nofollow">https://staging.mead.com.ph/login/key=abcde</a></strong></p>
  
  <p>HOWEVER,after echoing the result of the curl_exec, it says "<strong><em>Object Moved Here</em></strong>" and "<strong>HERE</strong>" redirects to <strong><a href="https://myservername/login/key=abcde" rel="nofollow">https://myservername/login/key=abcde</a></strong>
  instead of the <strong><a href="https://staging.mead.com.ph/login/key=abcde" rel="nofollow">https://staging.mead.com.ph/login/key=abcde</a></strong></p>
  
  <p>Here's my code : </p>
  
  <pre><code>$url    =  "https://staging.mead.com.ph/login/key=abcde";
  $token  = "token1234";
  $params = array(
      "Name" =&gt; "Ana",
      "Type" =&gt; "A",
      "Mobilenum" =&gt; "0919123456"
      );
   foreach($params as $key =&gt; $value) { 
      $fields .= $key . '=' . $value . '&amp;'; 
   }
   rtrim($fields, '&amp;');
   $post = curl_init();
  
   curl_setopt($post, CURLOPT_URL, $url);
   curl_setopt($post, CURLOPT_POST, count($params));
   curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
   curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($post, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($post, CURLOPT_SSL_VERIFYHOST, false); 
   curl_setopt($post, CURLOPT_FOLLOWLOCATION, true);  
  
   curl_setopt($post, CURLOPT_PROXYUSERPWD, PROXY_AUTH);
   curl_setopt($post, CURLOPT_PROXY, PROXY_URL);
   curl_setopt($post, CURLOPT_PROXYPORT, PROXY_PORT);
   curl_setopt($post, CURLOPT_TIMEOUT,6);
  
   $result = curl_exec($post);
  
   echo $result;
  
   curl_close($post);
  </code></pre>
  
  <p>What could be wrong? Thanks in advance.</p>