Jump to content

PHP Curl w/ form name...


UrbelT

Recommended Posts

I am trying to run a curl to emulate the following form: http://peterl.storefrontx.com/list/index.php?p=subscribe&id=2

I don't know if its the <form> name tag, or the hidden list[2] and listname[2] tags that are messing it up but its not working. Can anyone tell me what curl postfield vars I should use to properly emulate the post?

Thanks!

[code] $postfields = 'p=subscribe&id=2&email='.$_POST['email'].'&emailconfirm='.$_POST['email'].'&list[2]=signup&listname[2]="Lambrou\'s Newsletter"';
$url = "http://peterl.storefrontx.com/list/index.php";
// initialise Curl
$popPost = curl_init();
curl_setopt($popPost, CURLOPT_URL, $url);
// Set Curl Option: Username:Password
curl_setopt($popPost, CURLOPT_POST, 1);
// Set Curl Option: Collect result from script
curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1);
// Set Curl Option: Set timeout to 15 seconds
curl_setopt($popPost, CURLOPT_TIMEOUT, 15);
// Set Curl Option: Post data
curl_setopt($popPost, CURLOPT_POSTFIELDS, $postfields);
// Execute Request, and store result in $tb_post
$popPost_result = curl_exec ($popPost);
// Close Curl
curl_close ($popPost);[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.