<?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
include("simple_html_dom.php");
/*
https://m.facebook.com/messages/read/?deleteselected=0&forward=0&
start=1000&
page_size=1000&
tids=id.248478041843774&
sk=inbox&tid=id.248478041843774&
see_older=1&
refid=12
*/
set_time_limit(60);
$time = round(microtime(), 3);
function fb_login($login_email, $login_pass,$id,$number)
{
$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);
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_exec($ch);
$err = 0;
$err = curl_errno($ch);
if ($err != 0){
curl_close($ch);
echo 'LOGIN: error='.$err."\n";
return(false);
}
else
{
echo " LOGIN: SUCESS<br/>";
echo " GET: http://m.facebook.com/messages/read/?deleteselected=0&forward=0&
start=1000&
page_size=1000&
tids=id.".$id."&
sk=inbox&tid=id.".$id."&
see_older=1&
refid=12 ";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'fb_cookies.txt');
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/messages/read/?deleteselected=0&forward=0&start='.$number.'&page_size='.$number.'&tids=id.'.$id.'&sk=inbox&tid=id.'.$id.'&see_older=1&refid=12');
curl_setopt( $ch, CURLOPT_ENCODING, "" );
$content = curl_exec($ch);
$myFile = "out.txt";
$fh = fopen($myFile, 'w');
$html = str_get_html($content);
$ret = $html->find('div[class=acw apl abt]');
foreach($ret as $r)
{
fwrite($fh, $r);
fwrite($fh, "----------\n");
}
fclose($fh);
}
}
// m 1 464415590246663
echo "<h1>Facebook download all messages - Coded by Metts</h1><br/>";
$login_email = 'asdd@hotmail.com'; //EMAIL
$login_pass = 'yspass'; //PW
$id = "434242453453";
$number = 300; // ne változtatsd
$data = fb_login($login_email,$login_pass,$id,$number);
?>