From 4108c6129a33144d77835efc3c258787dde0a1a7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Wed, 22 Jul 2020 10:42:12 -0400 Subject: [PATCH] Update maryland_voter.php --- api/maryland_voter.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/maryland_voter.php b/api/maryland_voter.php index 4b3fd6d..80595f9 100644 --- a/api/maryland_voter.php +++ b/api/maryland_voter.php @@ -15,6 +15,15 @@ function cut_part_out($start,$end,$whole){ } function MVgetPage($url,$cookie,$post){ + // spoof https://topic.alibabacloud.com/a/php-curl-fake-ip-address-and-header-information-code-instance_1_34_10139121.html + $randIP = "".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255); + $headers['CLIENT-IP'] = $randIP; + $headers['X-FORWARDED-FOR'] = $randIP; + $headerArr = array(); + foreach( $headers as $n => $v ) { + $headerArr[] = $n .':' . $v; + } + // end $url = str_replace('[month]',date('F'),$url); // replace month January through December $url = str_replace('[day]',date('j'),$url); // replace day 1 to 31 $url = str_replace('[yesterday]',date('j',strtotime('yesterday')),$url); // replace day 1 to 31 @@ -24,6 +33,10 @@ function MVgetPage($url,$cookie,$post){ curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("McGuire MEPS https://www.md-petition.com/ /%d.0",rand(4,50))); curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($curl, CURLOPT_HEADER, 1); + // spoof + curl_setopt ($curl, CURLOPT_HTTPHEADER , $headerArr ); //Structure IP + curl_setopt ($curl, CURLOPT_REFERER, $url); //Structure + // end curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true); if ($cookie != ''){ -- 2.20.1