Jump to content


PHP Curl w/ form name...

  • Please log in to reply
No replies to this topic

#1 UrbelT

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 September 2006 - 08:21 AM

I am trying to run a curl to emulate the following form: http://peterl.storef...=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?


$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);

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users