-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.11nk5.php
67 lines (48 loc) · 1.21 KB
/
test.11nk5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
use rdx\imap\IMAPMailbox;
require 'env.php';
require 'autoload.php';
header('Content-type: text/plain');
$mbox = new IMAPMailbox(IMAP_11NK5_HOST, IMAP_11NK5_USER, IMAP_11NK5_PASS, 'INBOX', ['ssl', 'novalidate-cert']);
$messages = $mbox->messages(false);
echo count($messages) . " new messages...\n\n";
exit;
foreach ( $messages AS $message ) {
$title = $message->subject();
var_dump($title);
$message->parts();
$body = $message->plainBody;
if ( $body ) {
$text = $body->content();
if ( preg_match('#^https?://[a-z0-9]#i', $text) ) {
$tags = preg_split('/\s+/', $text);
$url = array_shift($tags);
$tags = implode(' ', $tags);
if ( $tags ) {
var_dump($url);
var_dump($tags);
if ( $message->unseen ) {
$q = compact('title', 'url', 'tags');
$qs = http_build_query($q);
$rsp = @file_get_contents('http://hotblocks.nl/tags/index.php?'.$qs);
echo "SUBMIT URL: ";
if ( $rsp ) {
var_dump(strlen($rsp));
}
else {
echo "FAIL\n";
$message->unflag('seen');
}
}
/*else {
// 25% chance
if ( !rand(0, 3) ) {
echo "UNFLAG SEEN: ";
var_dump($message->unflag('seen'));
}
}*/
}
}
}
echo "\n\n\n\n\n\n";
}