X-Git-Url: http://git.hcoop.net/clinton/MarylandElectronicPetitionSignature.git/blobdiff_plain/694b66cd578d5cc948335c3aca9e13eadb29bd80..5b251e46c79a9b520a6d83303b86b555c686a67b:/api/maryland_voter.php diff --git a/api/maryland_voter.php b/api/maryland_voter.php dissimilarity index 79% index 5556278..d4362c2 100644 --- a/api/maryland_voter.php +++ b/api/maryland_voter.php @@ -1,182 +1,125 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SearchFirstName'>
SearchLastName'>
DOBMonth'>
DOBDay'>
DOBYear'>
SearchZipCode'>
SearchHouseNumber*'>
SearchMiddleInitial*'>
*Optional
-
- - - '@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']; -} -?> + '@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; +} + +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
    +
    +*/ +