HelpAnyone know the Http post url

Posts 1621 of 21 · Page 2 of 2
Quote Originally Posted by Botmaker View Post
send the verification email
i use "realmofthemadgod.appspot.com/char/verify?guid=fdfdfdfd@drdrb.com&password=123456"

conformation email reply link
"realmofthemadgod.appspot.com/account/v?b=4J314rX27VKa3za_&a=59222229345153718" <--random

imap php
it has some features like ignore duplicate verification emails (uses most recent) and it shows which mule it is working on

Code:
	

    <?php
     
    // requirements:
    // sudo apt-get install php5-imap php5-curl
     
    /* connect to gmail */
    $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
    $username = 'user@domain.com';
    $password = 'foo';
     
    /* try to connect */
    $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
     
    /* grab emails */
    $emails = imap_search($inbox,'SUBJECT "Verify email for Realm of the Mad God" SINCE "12 September 2013"');
     
    $total = count($emails);
     
    $current = 0;
     
    /* if emails are returned, cycle through each... */
    if($emails) {
     
      /* put the newest emails on top */
      rsort($emails);
     
     
      /* for every email... */
      foreach($emails as $email_number) {
       
        /* get information specific to this email */
     
        $overview = imap_fetch_overview($inbox,$email_number,0);
        $emailto = $overview[0]->to;
     
        $message = imap_fetchbody($inbox,$email_number,1);
     
        preg_match_all('/.+realmofthemadgod.appspot.com\/account\/v.+/', $message, $matches);
     
        $url = $matches[0][0];
     
        $data = array('email' => $emailto,'url'=>$url);
     
        $output[] = $data;
     
        $urls[] =  $url;
     
        $current++;
     
        echo "reading email: $current of $total $emailto \n";
     
      }
     
    /* close the connection */
    imap_close($inbox);
     
    $muleguids=array();
     
    foreach ($output as $entry) {
      if (in_array($entry["email"],$muleguids)) {
      //mule guid already in array
      }
      else {
    //    var_dump($entry);
        $muleguids[] = $entry["email"];
        $unique[]=$entry;
      }
    }
     
      $uniquecount = count($unique);
      $count = 0;
     
      foreach ($unique as $entry) {
     
        $returned_content = get_data($entry["url"]);
     
        $count++;
     
        $good = preg_match("/Thank you!/",$returned_content);
     
        if (  $good == true ) {
        echo "verify success: $count of $uniquecount ".$entry["email"]."\n";
        }
        else {
        echo "verify failure: $count of $uniquecount ".$entry["email"]."\n";
        }
     
      }
    }
     
     
    /* gets the data from a URL */
    function get_data($url) {
      $ch = curl_init();
      $timeout = 5;
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
      $data = curl_exec($ch);
      curl_close($ch);
      return $data;
    }
     
    ?>
the date filter is nice since its reliable even if the script gets interrupted
since the verification urls dont change its fine to reuse them

it could be more efficient though by ignoring already ready emails:
Code:
$emails = imap_search($inbox,'NEW SUBJECT "Verify email for Realm of the Mad God" SINCE "12 September 2013"');
Wow, so much code. Here is simpler solution

Code:
#!/usr/local/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Net::IMAP::Simple;
use URI::Find;  

my $server = new Net::IMAP::Simple('imap.example.com');
$server->login( 'catch-all-email@example.com', 'pa$$w0rd' );

my $i = $server->select('INBOX') + 1;

while ( $i-- ) {
    if ( !$server->seen($i) ) {
        my $finder = URI::Find->new( \&acceptVerification );
        my $txt    = $server->get($i);
        $finder->find( \$txt );

    }
}

sub acceptVerification {
    my $uri = shift;
    my $ua  = LWP::UserAgent->new;
    $ua->env_proxy;
    $ua->timeout(30);
    my $tmp;
    if ( $uri =~ /appspot/ ) {
        my $response = $ua->get($uri);
        if ( $response->is_success ) {
            $tmp = $response->decoded_content;
            if ( $tmp =~ /Thank/ ) {
                print "ok\n";
            }
            else {
                print "sux\n";
            }
        }
    }
}
Quote Originally Posted by bb1234bb View Post
Wow, so much code. Here is simpler solution

Code:
#!/usr/local/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Net::IMAP::Simple;
use URI::Find;  

my $server = new Net::IMAP::Simple('imap.example.com');
$server->login( 'catch-all-email@example.com', 'pa$$w0rd' );

my $i = $server->select('INBOX') + 1;

while ( $i-- ) {
    if ( !$server->seen($i) ) {
        my $finder = URI::Find->new( \&acceptVerification );
        my $txt    = $server->get($i);
        $finder->find( \$txt );

    }
}

sub acceptVerification {
    my $uri = shift;
    my $ua  = LWP::UserAgent->new;
    $ua->env_proxy;
    $ua->timeout(30);
    my $tmp;
    if ( $uri =~ /appspot/ ) {
        my $response = $ua->get($uri);
        if ( $response->is_success ) {
            $tmp = $response->decoded_content;
            if ( $tmp =~ /Thank/ ) {
                print "ok\n";
            }
            else {
                print "sux\n";
            }
        }
    }
}
looks great, much less code. how do you get it to work with gmail? gmail requires ssl and uses nonstandard port 993
Just use Net::IMAP::Simple::SSL
Quote Originally Posted by bb1234bb View Post
Just use Net::IMAP::Simple::SSL
thanks, that worked
I'm slightly lost been staring at this thread for at least an hour anyone wana pm me how to use this php code etc thanks I'l try repay you in anyway i can

edit tried installing phpeasy?? got adllr error yipee am i at least on the right track?
Posts 1621 of 21 · Page 2 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?