


code php curl pour se connecter à la bo?te aux lettres 163 et récupérer la liste d'amis de la bo?te aux lettres (testé)
Dec 30, 2016 am 10:20 AMPour parler franchement, la technologie CURL simule les actions du navigateur pour réaliser l'exploration de pages ou la soumission de formulaires. Grace à cette technologie, de nombreuses fonctions intéressantes peuvent être réalisées.
<?php error_reporting(0); //郵箱用戶(hù)名(不帶@163.com后綴的) $user = 'papatata_test'; //郵箱密碼 $pass = '000000'; //目標(biāo)郵箱 //$mail_addr = uenucom@163.com'; //登陸 $url = 'http://reg.163.com/logins.jsp?type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight%3D1%26verifycookie%3D1%26language%3D-1%26style%3D-1'; $ch = curl_init($url); //創(chuàng)建一個(gè)用于存放cookie信息的臨時(shí)文件 $cookie = tempnam('.','~'); $referer_login = 'http://mail.163.com'; //返回結(jié)果存放在變量中,而不是默認(rèn)的直接輸出 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_REFERER, $referer_login); $fields_post = array( 'username'=> $user, 'password'=> $pass, 'verifycookie'=>1, 'style'=>-1, 'product'=> 'mail163', 'selType'=>-1, 'secure'=>'on' ); $headers_login = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0', 'Referer' => 'http://www.163.com' ); $fields_string = ''; foreach($fields_post as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } $fields_string = rtrim($fields_string , '&'); curl_setopt($ch, CURLOPT_COOKIESESSION, true); //關(guān)閉連接時(shí),將服務(wù)器端返回的cookie保存在以下文件中 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_login); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); $result= curl_exec($ch); curl_close($ch); //跳轉(zhuǎn) $url='http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=-1&username=loki_wuxi'; $ch = curl_init($url); $headers = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //將之前保存的cookie信息,一起發(fā)送到服務(wù)器端 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); $result = curl_exec($ch); curl_close($ch); //取得sid preg_match('/sid=[^\"].*/', $result, $location); $sid = substr($location[0], 4, -1); //file_put_contents('./result.txt', $sid); //通訊錄地址 $url='http://g4a30.mail.163.com/jy3/address/addrlist.jsp?sid='.$sid.'&gid=all'; $ch = curl_init($url); $headers = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); $result = curl_exec($ch); curl_close($ch); //file_put_contents('./result.txt', $result); unlink($cookie); //開(kāi)始抓取內(nèi)容 preg_match_all('/<td class="Ibx_Td_addrName"><a[^>]*>(.*?)<\/a><\/td><td class="Ibx_Td_addrEmail"><a[^>]*>(.*?)<\/a><\/td>/i', $result,$infos,PREG_SET_ORDER); //1:姓名2:郵箱 print_r($infos); ?>
Pour plus de code php curl pour vous connecter à la bo?te aux lettres 163 et récupérer la liste d'amis de la bo?te aux lettres (testée), veuillez faire attention au site Web PHP chinois pour les articles connexes?!

Outils d'IA chauds

Undress AI Tool
Images de déshabillage gratuites

Undresser.AI Undress
Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover
Outil d'IA en ligne pour supprimer les vêtements des photos.

Clothoff.io
Dissolvant de vêtements AI

Video Face Swap
échangez les visages dans n'importe quelle vidéo sans effort grace à notre outil d'échange de visage AI entièrement gratuit?!

Article chaud

Outils chauds

Bloc-notes++7.3.1
éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)