X-Git-Url: http://git.hcoop.net/clinton/MarylandElectronicPetitionSignature.git/blobdiff_plain/183344e41efe6bed56be50b60f41c4440528ca3b..5b251e46c79a9b520a6d83303b86b555c686a67b:/api/maryland_voter.php diff --git a/api/maryland_voter.php b/api/maryland_voter.php index 28cf6f8..d4362c2 100644 --- a/api/maryland_voter.php +++ b/api/maryland_voter.php @@ -1,5 +1,20 @@ '@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; } -$form['url'] = 'https://voterservices.elections.maryland.gov/VoterSearch'; -$form['html'] = getPage($form['url']); -echo '

RAW

'.htmlspecialchars($form['html']).'
'; -echo $form['html']; + +function md_voter_lookup($SearchFirstName,$SearchLastName,$DOBMonth,$DOBDay,$DOBYear,$SearchZipCode,$SearchHouseNumber,$SearchMiddleInitial){ + global $petition; + $post['ctl00$MainContent$btnSearch'] = "Search"; + $post['btnSearch'] = "Search"; + $post['ctl00$MainContent$listLanguages'] = "en"; + $post['listLanguages'] = "en"; + $post['ctl00$MainContent$txtSearchFirstName'] = $SearchFirstName; + $post['txtSearchFirstName'] = $SearchFirstName; + $post['ctl00$MainContent$txtSearchLastName'] = $SearchLastName; + $post['txtSearchLastName'] = $SearchLastName; + $post['ctl00$MainContent$txtDOBMonth'] = $DOBMonth; + $post['txtDOBMonth'] = $DOBMonth; + $post['ctl00$MainContent$txtDOBDay'] = $DOBDay; + $post['txtDOBDay'] = $DOBDay; + $post['ctl00$MainContent$txtDOBYear'] = $DOBYear; + $post['txtDOBYear'] = $DOBYear; + $post['ctl00$MainContent$txtSearchZipCode'] = $SearchZipCode; + $post['txtSearchZipCode'] = $SearchZipCode; + $post['ctl00$MainContent$txtSearchHouseNumber'] = $SearchHouseNumber; + $post['txtSearchHouseNumber'] = $SearchHouseNumber; + $post['ctl00$MainContent$txtSearchMiddleInitial'] = $SearchMiddleInitial; + $post['txtSearchMiddleInitial'] = $SearchMiddleInitial; + // start a session to get a cookie + $form['url'] = 'https://voterservices.elections.maryland.gov/VoterSearch'; + $form['html'] = MVgetPage($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']); + $result['html'] = MVgetPage($form['url'],$cookie,$post); + //echo "

STEP 2: SBE RESULTS

"; + $return['debug'] = htmlspecialchars($result['html']); + $return['html'] = $result['html']; + $html = $petition->real_escape_string($result['html']); + $petition->query("INSERT INTO `RemoteVoterList` (`date_validated`, `txtSearchFirstName`, `txtSearchLastName`, `txtDOBMonth`, `txtDOBDay`, `txtDOBYear`, `txtSearchZipCode`, `txtSearchHouseNumber`, `txtSearchMiddleInitial`, `sbe_response`) +VALUES (now(), '$SearchFirstName', '$SearchLastName', '$DOBMonth', '$DOBDay', '$DOBYear', '$SearchZipCode', '$SearchHouseNumber', '$SearchMiddleInitial', '$html')"); + return $result['html']; +} +/* +if (isset($_POST['SearchFirstName'])){ + $voter = md_voter_lookup($_POST['SearchFirstName'],$_POST['SearchLastName'],$_POST['DOBMonth'],$_POST['DOBDay'],$_POST['DOBYear'],$_POST['SearchZipCode'],$_POST['SearchHouseNumber'],$_POST['SearchMiddleInitial']); + echo $voter['html']; +} +?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SearchFirstName
SearchLastName
DOBMonth
DOBDay
DOBYear
SearchZipCode
SearchHouseNumber*
SearchMiddleInitial*
*Optional
+
+*/ +