Jump to content

Recommended Posts

Posted

Hello,

 

I can't figure out a few lines of cURL code.

 

I have 3 files involved...

 

File #1 will have a form that submits the form data (via POST) to FILE #2.

 

File #2 receives the POST, automatically re-posts the exact same data to File #3, then continues to process some of the info the POST contained.

 

File #3 receives the POST from File #2, and processes it normally (and this is where the USER should end up).

 

 

What I can't figure out is the part (in file #2) that receives the POST then AUTOMATICALLY REPOSTS it. The cURL code that I have to work with doesn't seem to work so far. Here's what I have to work with:

 

$url='File_number_3';

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($_POST));
curl_setopt($ch,CURLOPT_POSTFIELDS,$_POST);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

 

Anyone know what I need to do with this code to simply get it to take the incoming POST, then re-submit it to File_number_3 ?

Thanks :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...