Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 7th, 2013  |  syntax: PHP  |  size: 1.13 KB  |  views: 571  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3.  
  4. $ch = curl_init();
  5. $headerdata = array("Origin: https://www.facebook.com",
  6. "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
  7. "Content-Type: application/x-www-form-urlencoded",
  8. "Referer: https://www.facebook.com/messages/123456789",
  9. "Cookie:  your cookie data goes here");
  10. curl_setopt($ch, CURLOPT_URL, 'https://www.facebook.com/ajax/mercury/thread_info.php');
  11. curl_setopt($ch, CURLOPT_HEADER, 0);
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_HTTPHEADER, $headerdata);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. // [limit]=20000 messages
  16. curl_setopt($ch,CURLOPT_POSTFIELDS, "messages[thread_ids][id.123456789][offset]=0&messages[thread_ids][id.123456789][limit]=20000&&client=web_messenger&__user=123456789&__a=1&__dyn=123456789ABCDEF&__req=f&fb_dtsg=ABCDEF&ttstamp=123456789");
  17. $x = curl_exec($ch); curl_close($ch);
  18.  
  19. $x = str_replace("for (;;);", "", $x);
  20.  
  21. $data= json_decode($x);
  22.  
  23. foreach($data->payload->actions as $value) {
  24.  
  25.         echo $value->timestamp . "\t" . $value->author . "\t" . str_replace("\n", " ", $value->body). "\n";
  26. }
  27.  
  28. ?>