'@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){ $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'] = 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']); /* 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 "
    "; */ $result['html'] = getPage($form['url'],$cookie,$post); //echo "

    STEP 2: SBE RESULTS

    "; $return['debug'] = htmlspecialchars($result['html']); $return['html'] = $result['html']; return $return; } 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
    */ ?>