'@file_to_upload.png', 'upload_text' => '@text_to_upload' ); curl_setopt ($curl, CURLOPT_POSTFIELDS, $postFields); */ $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 $VIEWSTATE = cut_part_out('id="__VIEWSTATE" value="','"',$form['html']); $VIEWSTATEGENERATOR = cut_part_out('id="__VIEWSTATEGENERATOR" value="','"',$form['html']); $VIEWSTATEENCRYPTED = cut_part_out('id="__VIEWSTATEENCRYPTED" value="','"',$form['html']); $EVENTVALIDATION = cut_part_out('id="__EVENTVALIDATION" value="','"',$form['html']); // Voter Info Form Elements $Languages_field = '$ctl00$MainContent$listLanguages'; $Languages = "en"; if (isset($_POST['SearchFirstName'])){ $SearchFirstName_field = 'ctl00$MainContent$txtSearchFirstName'; $SearchFirstName = $_POST['SearchFirstName']; } if (isset($_POST['SearchLastName'])){ $SearchLastName_field = 'ctl00$MainContent$txtSearchLastName'; $SearchLastName = $_POST['SearchLastName']; } if (isset($_POST['DOBMonth'])){ $DOBMonth_field = 'ctl00$MainContent$txtDOBMonth'; $DOBMonth = $_POST['DOBMonth']; } if (isset($_POST['DOBDay'])){ $DOBDay_field = 'ctl00$MainContent$txtDOBDay'; $DOBDay = $_POST['DOBDay']; } if (isset($_POST['DOBYear'])){ $DOBYear_field = 'ctl00$MainContent$txtDOBYear'; $DOBYear = $_POST['DOBYear']; } if (isset($_POST['SearchZipCode'])){ $SearchZipCode_field = 'ctl00$MainContent$txtSearchZipCode'; $SearchZipCode = $_POST['SearchZipCode']; } // debug - show full response make sure we have the cookie echo "