Skip to content

Instantly share code, notes, and snippets.

@voidet
Created February 2, 2017 05:21
Show Gist options
  • Save voidet/00b74ffc5d901261479e4a95897f01a6 to your computer and use it in GitHub Desktop.
Save voidet/00b74ffc5d901261479e4a95897f01a6 to your computer and use it in GitHub Desktop.
<?php
$URL = 'https://egov.uscis.gov/casestatus/mycasestatus.do?appReceiptNum=LIN';
$lin = 1690882870;
$myfile = fopen("lins.txt", "w");
$i = 0;
while (true) {
$DOM = new DOMDocument;
$yay = $lin - $i;
$mewurl = $URL.$yay;
$ch = curl_init($mewurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch,CURLOPT_HTTPHEADER, array('User-Agent: Case Tracker/4.3.3 CFNetwork/808.3 Darwin/16.3.0', 'Accept-Encoding: gzip, deflate', 'Accept: */*'));
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
$html = curl_exec($ch);
curl_close($ch);
if (strpos($html, 'Form I-140')) {
preg_match('/\<h1\>(.*?)\<\/h1\>/', $html, $status);
fwrite($myfile, 'LIN'.$yay." - ".$status[1]."\n");
echo 'FOUND: LIN'.$yay." - ".$status[1]."\n";
}
$i++;
sleep(1);
}
fclose($myfile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment