PHP は、163、gmail、126 などの電子メール連絡先アドレスを取得します。

WBOY
リリース: 2016-07-29 08:40:56
オリジナル
1997 人が閲覧しました

インターネットでいくつか見つけましたが、ほとんどが有効期限が切れているので、特別に126のコードを公開しました。163は少し異常で、さらにジャンプが1つあり、さらに面倒です

コードをコピー コードは次のとおりです:


/**
* @file class.126http.php
* 126 の電子メール アドレス リストを取得します
* @author jvones http://www.jvones.com/blog
* @date 2009-09-26
**/
class http126
{
private function login($username, $password)
{
//最初のステップ: 初期ログイン
$cookies = array(); $ch =curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, "https://reg.163.com/logins.jsp?type=1&product=mail126&url=http: / /entry.mail.126.com/cgi/ntesdoor?hid%3D10010102%26lightweight%3D1%26verifycookie%3D1%26 language%3D0%26style%3D-1");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=".$username."@126.com&password=".$password);
curl_setopt($ch,CURLOPT_HEADER,1); ($ch, CURLOPT_TIMEOUT, TIMEOUT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//file_put_contents('./126result.txt', $str); $ch);
//126result.txt から参照できる redirect_url ジャンプ アドレスを取得し、正規表現を使用して $str リターン ストリーム内のアドレスと一致します
preg_match("/replace("(.*?)") ;/ ", $str, $mtitle);
$_url1 = $mtitle[1];
//file_put_contents('./126resulturl.txt', $redirect_url);
//ステップ 2: 再度先頭にジャンプします$ _url1
$ch =curl_init($_url1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch , CURLOPT_COOKIEJAR, COOKIEJAR);
curl_setopt($ch,CURLOPT_HEADER,1);
$str2 =curl_close($ch);
if ($contents, "安全な終了"); false )
{
return 0;
}
return 1;
/**
* メールアドレス帳のアドレスを取得します
* @param $user
* @param $password
* @param $result
* @return array
*/
public function getAddressList($username, $password)
{
if (!$this->login($ユーザー名 , $パスワード))
{
return 0;
$header = $this->_getheader($username);
if (!$header['sid'])
{
return 0; / / sid (非常に重要) とホストを見つけるためのテスト
//file_put_contents('./host.txt', $header['host'])
//file_put_contents('./sid.txt', $header); [' sid']);
//シミュレートされたクロールの入力を開始します
$ch =curl_init();
curl_setopt($ch, CURLOPT_URL, "http://".$header['host']."/a/s ? sid=".$header['sid']."&func=global:sequential");
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/ xml "));
$str = " pab :searchContactsFN<ブール名= "ignoreCase">trueuser:getSignaturespab:getAllGroups";
curl_setopt($ch , Curlopt_post, 1);
CURL_SETOPT ($ CH, Curlopt_postfields, $ ch);
$Contents =
ob_END_CLEAN();
//メールリストを取得ページ情報からユーザー名 && メールアドレス
preg_match_all("/>$users = array();
foreach($names[1] as $k =>$user)
{
//$user = iconv($user,'utf-8','gb2312');
$users[ $mails[1][$k]] = $user;
if (!$users)
{
return 'メールボックスにはまだ連絡先がありません'
}
return $users;
/**
* ヘッダー情報を取得します
*/
プライベート関数 _getheader($username)
{
$ch =curl_init();
curl_setopt($ch, CURLOPT_URL, "http://entry.mail.126.com/cgi/ntesdoor?hid=10010102&lightweight=1&verifycookie=1& language=0&style=-1&username=".$username."@126.com") ;
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR); //現在使用されているクッキー
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIEJAR); // サービスが返す新しい cookie
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$c
preg_match_all('/Location:s*(.*?)rn/i',$content,$regs);
$refer = $regs[1][0];
preg_match_all('/http://(.*?)//i',$refer,$regs);
$host = $regs[1][0];
preg_match_all("/sid=(.*)/i",$refer,$regs);
$sid = $regs[1][0];
curl_close($ch);
return array('sid'=>$sid,'refer'=>$refer,'host'=>$host);
}
}
?>


 PHP获取163、gmail、126等邮箱联系人地址

以上は、PHP 取得 163、gmail、126 などのセキュリティボックスを介して、側面の内容を含み、PHP 教程に関心のある友人の助けになることを望みます。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!