'@file_to_upload.png',
'upload_text' => '@text_to_upload'
);
*/
if ($post != ''){
curl_setopt ($curl, CURLOPT_POSTFIELDS, $post);
}
$html = curl_exec ($curl);
curl_close ($curl);
return $html;
}
// start a session to get a cookie
$form['url'] = 'https://voterservices.elections.maryland.gov/VoterSearch';
$form['html'] = getPage($form['url'],'','');
// extract the cookie from the header (see CURLOPT_HEADER)
$cookie = cut_part_out('ASP.NET_SessionId=',';',$form['html']);
// extract the form elements we will need to post with our data
$post['__VIEWSTATE'] = cut_part_out('id="__VIEWSTATE" value="','"',$form['html']);
$post['__VIEWSTATEGENERATOR'] = cut_part_out('id="__VIEWSTATEGENERATOR" value="','"',$form['html']);
$post['__VIEWSTATEENCRYPTED'] = cut_part_out('id="__VIEWSTATEENCRYPTED" value="','"',$form['html']);
$post['__EVENTVALIDATION'] = cut_part_out('id="__EVENTVALIDATION" value="','"',$form['html']);
// Voter Info Form Elements
//$post['Languages_field'] = 'ctl00$MainContent$listLanguages';
// debug - show full response make sure we have the cookie
echo "COOKIE ASP.NET_SessionId $cookie";
echo "POST VIEWSTATE $post[__VIEWSTATE]";
echo "POST VIEWSTATEGENERATOR $post[__VIEWSTATEGENERATOR]";
echo "POST VIEWSTATEENCRYPTED $post[__VIEWSTATEENCRYPTED]";
echo "POST EVENTVALIDATION $post[__EVENTVALIDATION]";
echo "";
echo print_r($post);
echo "
";
echo "
STEP 1: Input Form
";
echo htmlspecialchars($form['html']);
echo '
';
echo $form['html'];
if ($post['txtSearchFirstName'] != ''){
$result['html'] = getPage($form['url'],$cookie,$post);
echo "
STEP 2: SBE RESULTS
";
echo htmlspecialchars($result['html']);
echo '
';
echo $result['html'];
}
?>