Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // CODED BY Metts / metts.blog.hu / da.metts@hotmail.com
- // FACEBOOK all message download
- // A Kódért felelősséget nem vállalok!
- // kő még simple_html_dom.php http://simplehtmldom.sourceforge.net/ egy mappaba vele
- // elvileg letölti az összes üzenet amit eddig a felhasználóval beszéltünk
- /*
- completed by Greg
- mosmá' működik is
- tessék böngészőbő' indítani
- üzeneteket ide rakja: c://xampp/htdocs/out.html
- */
- $login_email = '';
- $login_pass = '';
- header('Content-Type: text/html; charset=utf-8');
- include("phpdom/simple_html_dom.php");
- set_time_limit(0);
- function req (&$ch) {
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
- curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
- curl_setopt($ch, CURLOPT_NOBODY, false);
- return curl_exec($ch);
- }
- function fb_login($login_email, $login_pass) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'http://login.facebook.com/login.php?login_attempt=1');
- curl_setopt($ch, CURLOPT_POSTFIELDS,'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&locale=en_US&email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&pass_placeholder=&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84');
- curl_setopt($ch, CURLOPT_POST, 1);
- $content = req ($ch);
- $err = curl_error($ch);
- if ($err == 0) {
- $html = str_get_html($content);
- $ret = $html->find('.login_error_box');
- if (count($ret) != 0) {
- $ret = $ret[0];
- return $ret->innertext;
- } else {
- return true;
- }
- } else {
- curl_close($ch);
- return $err;
- }
- }
- function getUsers () {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/messages/');
- $content = req ($ch);
- $html = str_get_html($content);
- return $html->find('#threadlist_rows', 0);
- }
- function get_messages ($id) {
- $myFile = "c://xampp/htdocs/out.html";
- $fh = fopen($myFile, 'w');
- $last = '';
- for ($i = 0; true; $i += 7) {
- $url = 'http://m.facebook.com/messages/read/?deleteselected=0&forward=0&start=' . $i . '&page_size=0&tids=' . $id . '&sk=inbox&tid=' . $id . '&see_newer=1&refid=12';
- for ($j = 0; $j < 5; $j ++) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_ENCODING, "");
- $html = str_get_html(req ($ch));
- if (is_object ($html)) {
- break;
- } else {
- echo "Error @ try #$j $html\n";
- }
- flush();
- ob_flush();
- }
- $ret = $html->find('div[class=acw apl abt]');
- foreach($ret as $r) {
- fwrite($fh, $r);
- fwrite($fh, "----------\n");
- }
- echo "got $i<br/>";
- flush();
- ob_flush();
- if ($r == $last) {
- break;
- } else {
- $last = $r;
- }
- }
- fclose($fh);
- }
- if (isset ($_GET['u'])) {
- get_messages ($_GET['u']);
- } else {
- for ($i = 0; ($i < 3 && ($ret = fb_login($login_email, $login_pass)) !== true); $i ++);
- if ($ret !== true) {
- exit ("<b>Belépési hiba!</b><br/>$ret");
- }
- $users = getUsers ()->find('a');
- for ($i = 0; $i < count ($users); $i ++) {
- parse_str(parse_url($users[$i]->href, PHP_URL_QUERY), $query);
- if (isset($query['tid'])) {
- echo '<a href="?u=' . $query['tid'] . '">' . trim($users[$i]->plaintext) . '</a><br/>';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement