Php simulated GMAIL, HOTMAIL (MSN), YAHOO, 163,126 email logon details

Source: Internet
Author: User
Tags intl
This article gives a detailed analysis of the methods for logon to php simulated GMAIL, HOTMAIL (MSN), YAHOO, and 163,126 email addresses. if you need a friend, you have been busy for reference recently, at the end of this holiday, I will post this article to make these source code open-source.
Of course, these methods may not be available, but it should be in this direction, because the current UCHOME Port station
We planned to change the display method in the friend invitation. at first, I didn't care about it. that's all!
When we got this, we found that the place in UCH is made of roaming type, which makes people have no solution and cannot be changed!
Alas, since I have promised to say yes, but now the actual situation is not good, I feel sorry. to solve this problem quickly, on GOOGLE,
Baidu searched it again, and the result was unexpected. in the example of an open-source 126 mailbox, none of the others were found. some cool kept QQ and asked for other source code,
You can buy it with QQ! No comment on this person! I spent some time and finished the whole process, and I was lucky enough to get a few results. due to limited time, I have been working on projects, so I don't care about anything else. now I am giving GMAIL, HOTMAIL (MSN), PHP source code of YAHOO's email contact:

1. GMAIL

The code is as follows:


Define ("COOKIEJAR", tempnam (ini_get ("upload_tmp_dir"), "cookie"); // defines the path where COOKIES are stored and requires operation permissions
Define ("TIMEOUT", 1000); // time-out setting
Class GMAIL
{
Private function login ($ username, $ password)
{
// Step 1: capture the data on the logon page and write down the cookies
$ Cookies = array ();
$ Matches = array ();
// Obtain the form
$ Login_url = "https://www.google.com/accounts/ServiceLoginAuth ";
$ Ch = curl_init ($ login_url );

Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
$ Contents = curl_exec ($ ch );
Curl_close ($ ch );
// Simulate parameters
$ Name = array ('dsh', 'timestamp', 'sectok ');
Foreach ($ name as $ v ){
Preg_match ('//I ', $ contents, $ matches );
If (! Empty ($ matches )){
$ V = $ matches [1];
$ Matches = array ();
}
}
$ Server = 'mail ';
Preg_match ('//I ', $ contents, $ matches );
If (! Empty ($ matches )){
$ GALX = $ matches [1];
$ Matches = array ();
}
$ TimeStmp = time ();

// Step 2: start logging on
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_URL, "https://www.google.com/accounts/ServiceLoginAuth ");
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
$ Fileds = "dsh = $ dsh & Email = ". $ username. "& Passwd = {$ password} & GALX = $ GALX & timeStmp = $ timeStmp & secTok = $ secTok & signIn = Sign in & rmShown = 1 & asts = & PersistentCookie = yes";
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ fileds );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Str = curl_exec ($ ch );
Curl_close ($ ch );

// Step 3: check Cookies is also a boot page
$ Ch = curl_init ("https://www.google.com/accounts/CheckCookie? Chtml = LoginDoneHtml ");

Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
$ Str2 = curl_exec ($ ch );

Curl_close ($ ch );

If (strpos ($ contents, "exit safely ")! = False)
{
Return FALSE;
}
Return TURE;
}

// Obtain the email address book-address
Public function getAddressList ($ username, $ password)
{
If (! $ This-> login ($ username, $ password ))
{
Return FALSE;
}
// Start to enter the simulated capture
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "http://mail.google.com/mail/contacts/data/contacts? Thumb = true & groups = true & show = ALL & enums = true & psort = Name & max = 300 & out = js & rf = & jsx = true "); // out = json data returned by js. If this parameter is not set, xml data is returned.
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
/* This setting is required when xml data is returned.
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ("Content-Type: application/xml "));
$ Str =" Pab: searchContacts FN True User: getSignatures Pab: getAllGroups ";
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ str );

*/
Curl_setopt ($ ch, CURLOPT_POST, 1 );

Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
$ Contents = curl_exec ($ ch );
Curl_close ($ ch );
// Die ($ contents );
// Get mail list from the page information username & emailaddress
/* Processing when xml data is returned
Preg_match_all ("/ (.*) /Umsi ", $ contents, $ mails );
Preg_match_all ("/ (.*) /Umsi ", $ contents, $ names );
$ Users = array ();
Foreach ($ names [1] as $ k => $ user)
{
// $ User = iconv ($ user, 'utf-8', 'gb2312 ');
$ Users [$ mails [1] [$ k] = $ user;
}
If (! $ Users)
{
Return 'No contacts in your mailbox ';
}
*/
$ Contents = substr ($ contents, strlen ('while (true); & START &&&'), -strlen ('& END &&&'));
Return $ contents;
}
}
$ Gamil = new GMAIL;
$ Res = $ gamil-> getAddressList ('username @ 163.com ', '123 ');
Echo $ res;
?>


2. HOTMAIL (MSN)

The code is as follows:


Define ("COOKIEJAR", tempnam (ini_get ("upload_tmp_dir"), "cookie"); // defines the path where COOKIES are stored and requires operation permissions
Define ("TIMEOUT", 1000); // time-out setting
Class MSN
{
Function getAddressList ($ username, $ password)
{
// Step 1: capture the data on the logon page and write down the cookies
$ Cookies = array ();
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_URL, "http://login.live.com/login.srf? Wa = wsignin1.0 & rpsnv = 11 & ct = ". time (). "& rver = 6.0.5285.0 & wp = MBI & wreply = http: % 2F % 2Fmail.live.com % 2Fdefault. aspx & lc = 2052 & id = 64855 & mkt = en ");
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Str = curl_exec ($ ch );
Curl_close ($ ch );
// Parameter analysis
$ Matches = array ();
Preg_match ('//I ', $ str, $ matches );
$ PPFT = $ matches [2];

Preg_match ('/srf_sRBlob = /'(.*?) /';/I', $ str, $ matches );
$ PPSX = $ matches [1];

$ Type = 11;

$ LoginOptions = 3;

$ Newuser = 1;

$ Idsbho = 1;

$ I2 = 1;

$ I12 = 1;

$ I3 = '20140901 ';

$ PPSX = 'Pa ';
// Merge parameters
$ Postfiles = "login = ". $ username. "& passwd = ". $ password. "& type = ". $ type. "& LoginOptions = ". $ LoginOptions. "& Newuser = ". $ Newuser. "& idsbho = ". $ idsbho. "& i2 = ". $ i2. "& i3 = ". $ i3. "& PPFT = ". $ PPFT. "& PPSX = ". $ PPSX. "& i12 = 1 ";

// Step 2: start logging on
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_URL, 'https: // login.live.com/ppsecure/post.srf? Wa = wsignin1.0 & rpsnv = 11 & ct = '. (time () + 5 ). '& rver = 6.0.5285.0 & wp = MBI & wreply = http: % 2F % 2Fmail.live.com % 2Fdefault. aspx & lc = 2052 & id = 64855 & mkt = en & bk = '. (time () + 715); // The two time () here are used to simulate random time.
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ postfiles );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
// Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );

$ Content = curl_exec ($ ch );
Curl_close ($ ch );

If (stripos ($ content, 'wlworkflow ')! = FALSE) {// WLWorkflow logon page JS
Return false; // logon failed
}
// Obtain the location link
$ Matches = array ();
Preg_match ('/window. location. replace /(/"(.*?) /"/)/I ', $ content, $ matches );
$ Url_contiune_1 = $ matches [1]; // next link
If (! $ Url_contiune_1 ){
Return false;
}
// Step 3: Go to the boot page

$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_URL, $ url_contiune_1 );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Content_2 = curl_exec ($ ch );

// Echo $ postfiles;
Curl_close ($ ch );

// Get the redicturl link
$ Matches = array ();
Preg_match ('// I', $ content_2, $ matches );
$ Url_contiune_2 = $ matches [1]; // next link
If (! $ Url_contiune_2 ){
Return false;
}

// Skip to the homepage
/*
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_URL, $ url_contiune_2 );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 1000 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Content_3 = curl_exec ($ ch );

Curl_close ($ ch );
*/
// Obtain the base address of the mailbox request to read the host
$ Matches = array ();
Preg_match ('/(.*?) ////(.*?) //(.*?) /I ', $ url_contiune_2, $ matches );
$ Url_contiune_3 = trim ($ matches [1]). '//'. trim ($ matches [2]); // the base address of the site defined on the homepage
$ Url_4 = $ url_contiune_3. '/mail/ContactMainLight. aspx? N = 100'; // The number following n is a random number.
If (! $ Url_contiune_3 ){
Return false;
}

// Step 4: Get the email contact
// Base $ url_4
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_URL, $ url_4 );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Str = curl_exec ($ ch );
// Analyze data (the data here is invisible on the page because of the JS processing mechanism of hotmail, and the data can be seen on the source code)
Return $ this-> hanlde_date ($ str );

}
Function hanlde_date ($ data ){
$ New_str = array ();
If (! Empty ($ data )){
$ Ops_start = stripos ($ data, 'IC _ control_data ');
$ Ops_end = stripos ($ data, ';', $ ops_start );
$ New_str = substr ($ data, $ ops_start + strlen ('IC _ control_data = '), $ ops_end-$ ops_start-strlen ('IC _ control_data = '));
Return $ new_str; // return the JSON object
} Else {
Return array ();
}


}
}
$ Msn = new MSN;
$ Res = $ msn-> getAddressList ('username @ 111.com ', '123 ');
Echo $ res;
?>


3. YAHOO

The code is as follows:


Define ("COOKIEJAR", tempnam (ini_get ("upload_tmp_dir"), "cookie"); // defines the path where COOKIES are stored and requires operation permissions
Define ("TIMEOUT", 1000); // time-out setting
Class YAHOO
{
Private function login ($ username, $ password)
{
// Step 1: capture the data on the logon page and write down the cookies
$ Cookies = array ();
$ Matches = array ();

// Obtain the form
$ Login_url = "https://login.yahoo.com/config/login ?. Src = fpctx &. intl = us &. done = http % 3A % 2F % 2Fwww.yahoo.com % 2F ";
$ Ch = curl_init ($ login_url );

Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
$ Contents = curl_exec ($ ch );
Curl_close ($ ch );

// Construct parameters
$ Name = array ('trigges', 'src', 'md5', 'hash', 'js', 'last', 'promo', 'intl ', 'bypass', 'parter', 'u', 'V', 'Challenge ', 'yplus', 'emailcode', 'pkg ', 'stepid', 'ev ', 'hasmsgr ', 'chkp', 'done', 'PD ', 'pad', 'aad ');
$ Postfiles = array ();
$ Matches = array ();
Foreach ($ name as $ v ){
Preg_match ('//I ', $ contents, $ matches );
If (! Empty ($ matches )){
$ Postfiles ['.'. $ v] = $ matches [1];
$ Matches = array ();
}
If ($ v = 'PD '){
$ Postfiles ['.'. $ v] = urlencode ($ postfiles ['.'. $ v]);
}
}
$ Postfiles ['pad '] = 5;
$ Postfiles ['ad'] = 6;
$ Postfiles ['login'] = urlencode ($ username );
$ Postfiles ['passwd'] = $ password;
$ Postfiles ['. persistent'] = 'y ';
$ Postfiles ['save'] = '';
$ Postfiles ['. done'] = urlencode ($ postfiles ['. done']);
// $ Postfiles ['. pd'] = urlencode ($ postfiles ['. pd']);
$ Postargs = '';

Foreach ($ postfiles as $ k => $ v ){
$ Postargs. = $ k. '='. $ v .'&';
}
$ Postargs = substr ($ postargs, 0,-1 );
$ Request = "https://login.yahoo.com/config/login? ";

// Start logging on
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_URL, $ request );

Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ postargs );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Contents = curl_exec ($ ch );
Curl_close ($ ch );
If (stripos ($ contents, 'submit ')! = FALSE)
{
Return 0;
}
Return 1;
}

// Obtain the email address book-address
Public function getAddressList ($ username, $ password)
{
If (! $ This-> login ($ username, $ password ))
{
Return 0;
}

// Start to enter the simulated capture
// Get mail list from the page information username & emailaddress
$ Url = "http://address.mail.yahoo.com /";
$ Data = array ();
If (! $ Data = $ this-> hanlde_date ($ url, $ names, $ emails ))
{
Return FALSE;
}
Echo'

';
Print_r ($ data );
Return $ data;
}
Function hanlde_date ($ url, & $ names, & $ emails)
{
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, COOKIEJAR );
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, TIMEOUT );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
$ Contents = curl_exec ($ ch );
Curl_close ($ ch );
$ Temparr = array ();
Preg_match_all ('/InitialContacts/s * =/s *(.*?); /I ', $ contents, $ temparr );
Return $ temparr [1] [0]. '; // match the JSON object array
}
}
$ Yahoo = new YAHOO;
$ Res = $ yahoo-> getAddressList ('username @ yahoo.com.cn ', '123 ');
?>


Note:
163,126 the source code is available on the Internet, so I won't list them here.
Of course, this code is your own practice, just to provide guidance for such problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.