Jump to content


Photo

PHP curl Form post without redirecting


  • Please log in to reply
4 replies to this topic

#1 RabPHP

RabPHP
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 23 August 2006 - 10:00 PM

Greetings,

I am attempting to create a form post for a 3rd party training website.  Essentially I want to post the data over, but not have the client redirected to their login after the post is completed.

The post data works and the 3rd party site registeres the entry, but I don't want their confirmation or the page the redirect for normal users to be displayed.  My code is as follows....

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://someURL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "mft_userID=$username&mft_Pwd=$password&mft_Fname=$fname&mft_Lname=$lname&mft_userEmail=$email&mft_GrpID=$GroupID");

curl_exec ($ch);
curl_close ($ch);

I believe their are CURL options to do this, but I cannot find a good reference on the options.  I want the user to stay on my page after the post.  Any ideas greatly appreciated.
Rab

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 August 2006 - 10:13 PM

Try...

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);


#3 RabPHP

RabPHP
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 23 August 2006 - 10:16 PM

Tried that, didn't work.  Still redirects to their login page.

Rab

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 August 2006 - 10:28 PM

You could maybe also try setting CURLOPT_MAXREDIRS to 0. Im not sure really, havent used curl before.

#5 RabPHP

RabPHP
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 23 August 2006 - 10:35 PM

No love with that either.

Rab




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users