This article describes how to log on to a php-simulated GMAIL, HOTMAIL (MSN), YAHOO, and 163,126 email. For more information, see
This article describes how to log on to a php-simulated GMAIL, HOTMAIL (MSN), YAHOO, and 163,126 email. For more information, see
I have been busy recently. The U.S. server will post this article at the end of this holiday 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 the Hong Kong server has agreed to say yes, the actual situation is not good now, so I am sorry, In order to quickly solve this problem, on GOOGLE,
Baidu searched it once and rented a server in Hong Kong. Unexpectedly, there was no other open-source example of a 126 email address. Some cool kept QQ and asked for other source codes,
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: