If there are 2 form fields in a page with 2 different submit buttons how do I tell to cURL which form to submit?
Example
<form method="post" action="index.php"> <input type="text" name="age"> <input type="submit" name="agree"> <input type="submit" name="disagree"> </form> My code so far
//create array of data to be posted $post_data['age'] = '5'; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } $post_string = implode ('&', $post_items); curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);