Update maryland_voter.php
authorPatrick McGuire <insidenothing@gmail.com>
Wed, 22 Jul 2020 14:42:12 +0000 (10:42 -0400)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2020 14:42:12 +0000 (10:42 -0400)
api/maryland_voter.php

index 4b3fd6d..80595f9 100644 (file)
@@ -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 != ''){