· 6 years ago · Jan 08, 2020, 09:02 AM
1<?php
2
3 define("UPLOAD_URL", "https://bulkapi.millionverifier.com/bulkapi/v2/upload");
4 define("PROGRESS_URL", "https://bulkapi.millionverifier.com/bulkapi/v2/fileinfo");
5 define("DOWNLOAD_URL", "https://bulkapi.millionverifier.com/bulkapi/v2/download");
6
7
8 $key=@$_POST["key"];
9 if (!$key) $key=@$_GET["key"];
10
11 $file_id = $_GET["file_id"];
12
13 if ($_FILES['file_contents']) {
14 $cFile = curl_file_create($_FILES['file_contents']['tmp_name'], $_FILES['file_contents']['type'], $_FILES['file_contents']['name']);
15 $settings['file_contents'] = $cFile;
16 $settings['key'] = $key;
17 $ch = curl_init(UPLOAD_URL);
18 curl_setopt($ch, CURLOPT_POST, true);
19 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20 curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);
21 $res = curl_exec($ch);
22 curl_close($ch);
23 $o = @json_decode($res);
24 $error = @$o->error;
25 $file_id = @$o->file_id;
26 if (!$error) {
27 header("Location: ".$_SERVER['QUERY_STRING']."?file_id=$file_id&key=$key");
28 exit;
29 }
30 } elseif (@$file_id) {
31 $res = file_get_contents(PROGRESS_URL."?key=$key&file_id=$file_id");
32 $o = @json_decode($res);
33 }
34
35 if (!@$error && @$file_id) {
36 echo "<pre>".json_encode($o, JSON_PRETTY_PRINT)."</pre>";
37 if (!in_array($o->status,['finished', 'canceled'])) {
38 echo '<meta http-equiv="refresh" content="1">auto refresh...';
39 } else {
40 $url = DOWNLOAD_URL."?key=$key&file_id=$file_id&filter=";
41?>
42Download reports:<br>
43<li><a href="<?php echo $url?>ok">Ok only</a>
44<li><a href="<?php echo $url?>ok_and_catch_all">Ok & Catch All</a>
45<li><a href="<?php echo $url?>unknown">Unknown only</a>
46<li><a href="<?php echo $url?>invalid">Invalid only</a>
47<li><a href="<?php echo $url?>all">Full report</a>
48<?php
49 }
50 }
51
52 if (@$error) {
53 echo "<pre>Error: $error</pre>";
54 }
55
56 if (!@$file_id) { ?>
57<form method="post" enctype="multipart/form-data">
58 <table border="1" cellpadding="20" cellspacing="0">
59 <tr><th>Key</th><td><input name="key" value="<?php echo $key; ?>" placeholder="your api key"></td></tr>
60 <tr><th>File</th><td><input type="file" name="file_contents"></td></tr>
61 <tr><td colspan="2" align="center"><input type="submit" value="Verify"></td></tr>
62 </table>
63</form>
64<?php
65 }