Results 1 to 6 of 6

Thread: Retrieve facebook fan page in PHP

  1. #1
    Join Date
    Nov 2009
    Posts
    47

    Retrieve facebook fan page in PHP

    Currently, there is no tool or application to extract the names of fans of a "page" in facebook. So I decide to make my version of php

    I use file_get_contents () with context, to choose the options header.

    I want to convince Facebook that I want to load the lightbox listing the 100 by 100 fans as if I was on a standard web browser. The goal is to retrieve the html/javascript from the list to extract the names of fans.

    I analyzed wireshark headers and cookies sent by my browser when he made the motion, so classic.

    I then analyzed the response of facebook. The headers received are correct (200 OK). But I do not get the html as expected, but a boiled characters long not really readable.
    Code:
    //Headers sent
     
    Host: www.facebook.com 
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) 
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
    Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3 
    Accept-Encoding: gzip,deflate 
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 
    Keep-Alive: 300 
    Connection: keep-alive 
    X-SVN-Rev: 199440 
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8 
    Referer: http://www.facebook.com/home.php 
    Content-Length: 167 
    Cookie:full of stuff that I tell you =D 
    Pragma: no-cache 
    Cache-Control: no-cache 
     
    //Body of the POST request 
     
    edge_type=fan&page=1&limit=100&class=FanManager&node_id=110534460377&post_form_id=0fb5daac8db470a1c972ff2efb84eeea&fb_dtsg=pkPRc&post_form_id_source=AsyncRequest&__a=1 
     
     
    //Facebook Response 
     
    ’ÄVÓ¦ÈnJ”ÓòßçÜ"k±DfØ¢^>Õ`Æ™¾/«u]w9w»ªjëüñÿ~üý,«ëª>{d?hÿ߇f½fõÝÙ£³³Žò4Û,êüf›W¥F}µù«Ë¼=ºbÅ&{pvÃî**-Ïý~Öl²:ÍË«*~ˆƒÄ‰mßè‡ÿ^œmóm‘ë‡|]•Öû ?ãµ×uvâõv{óèòáåï_¿Î®Ø"›WÕ—Ù¢Z_>¼©««¼Èf7×7?çËŸ$ÇÿÁ“?mVk0Ù4sÁ?Ýä 
    £xž}™]ÍËrVfÛˇ;× 
    /:¶]>Äo%Û4‰œdöùfNu¶®v›Ó¹·uƒ_¼¥<®Wú 
    ×wiõßT÷ä›”-×9*‡ñsÁ6[Aì>µ`e:ÏÒyQ-¾dø*è³<8c 
    úÖ?f¿mqø§—mgÉ&_•YmákXggo¶5ÛfMÓµO*Ókö%ë^"¨§?!Žè„v„qxB¼*¢ä{ž¯.ò-dmý«*®¤ˆË¦(þ‹¤6[¶Í³ïinŸt“×U“m·Ùl•[#õ×Â]üŽ<Û²‘%š§¬`…õºúšiwï@0¯›¯Œÿû½‹dÄsì**x";ì0ñC!IPâyÂê 
    ×某Ò2¥ü‰ÙŽ?ñóT…=èø±sù0HpãäS?r|£t6IÕsè@×—R%ÕÇe™Yïs¨ýQ"eøø 7•ýò|^³rA;Æš¹�ò `ë<öV8õ|×6B*jh'Q9®´r’ „ú&_³¬°ÞT×Ý(Áîù1’é4?¦ã 
    !»$äЇ%ë4qϹWÈQä&IœH} 
    Yen has a full page, but I'm short.
    It looks like a picture, but I can not open it.

    The code for my php page:

    The user copy/paste the headers it has captured with wireshark.
    PHP Code:
    <?php
    $headers 
    strstr($_POST['post_header'],'Host:');
    $content strstr($_POST['post_body'],'edge_type');
    parse_str($content$result);
    $data= array();
    foreach(
    $result as $key=>$value)
    {
        
    $data[$key] = $value;
    }
    $content http_build_query$data);
    $options = array( 'http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0',
    'method' => 'POST',
    'content' => $content,
    'header' => $headers ) );
    $context stream_context_create$options );
    echo 
    nl2br($headers);echo '
    '
    ;
    echo 
    nl2br($content);
    echo 
    '
    '
    ;
    $return file_get_contents'http://www.facebook.com/ajax/social_graph/fetch.php'false$context );
    echo 
    nl2br($return);
    ?>

    Can you help me in retrieving facebook fan page with PHP?

  2. #2
    Join Date
    Nov 2008
    Posts
    1,054

    Re: Retrieve facebook fan page in PHP

    it is true that not even one little top will retrieve this info under the pretext that page_id page_fan in the table that is not indexed

  3. #3
    Join Date
    Nov 2009
    Posts
    47

    Re: Retrieve facebook fan page in PHP

    Some stories:

    This problem is resolved. I selected the large headers sent and only those. Now Facebook sends me well with the Javascript code names within.

    The problem now is complex. Stay well.

    I parse the headers with the function http_parse_headers () and I recovered in a table. Http_parse_headers function () is available in PECL extension and bookstore called php_http.dll. It is basic PHP.

    Once the code is retrieved, I must find the names contained. For that, I'm an explode () on the string, I get an array with the names followed by the rest of the code.

    Code:
    ....e}},"547426212":{"id":547426212,"title":"Jean Smith","href":"http:\/\/www.facebook.com\/jeansmith.... 
     
    devient 
     
    Jean Smith","href":"http:\/\/www.facebook.com\/jeansmith....
    It must now withdraw that is after the name.

    For this I use the function strstr () with a third parameter to TRUE to get the string before the landmark.
    All this in order to isolate
    John Smith
    The problem is that this improvement of the function strstr () (3rd parameter) is that since PHP 5.3, while the library php_http.dll does not (yet?) For PHP 5.3

    Do you know a solution?
    Equivalent to strstr () which runs on PHP 5.2.x? equivalent to http_parse_headers () which runs on PHP 5.3.x?

    I thought the first regex. But the performance is very long, and then I can not find a function that returns me a B chain sandwiched between two channels A and C.

    Another solution is to manufacture its own function strstr () reversed, also reviews site PHP abound. If there are no other solutions, I'll do it ...

  4. #4
    Join Date
    Nov 2008
    Posts
    1,054

    Re: Retrieve facebook fan page in PHP

    But why are you doing an explode, it's simply a json. So you should do json_decode

    Code:
    $json = str_replace('for (;;);', '', $response);
    $users = json_decode($json)->payload->user_info;
    print_r($users);
    It's simpler, right? Also directly in your object, simply put a 'true' in the 2nd parameter to be tabulated assoc

  5. #5
    Join Date
    Nov 2010
    Posts
    1

    Re: Retrieve facebook fan page in PHP

    so where would i put this code?

    can anyone please explain where?

    thanks

  6. #6
    Join Date
    Nov 2010
    Posts
    7

    Re: Retrieve facebook fan page in PHP

    Macario can you help me about my post ?

    Programming using JCreator

    I hope you can help me .

Similar Threads

  1. Can I retrieve my deleted Facebook Messages
    By Sutti in forum Technology & Internet
    Replies: 3
    Last Post: 20-01-2012, 10:36 PM
  2. Retrieve my Facebook password
    By runnerrunrun in forum Networking & Security
    Replies: 1
    Last Post: 14-10-2011, 01:09 PM
  3. Unable to retrieve page in kindle based on page numbers
    By rUChIRr in forum Portable Devices
    Replies: 6
    Last Post: 08-07-2011, 10:02 PM
  4. Replies: 1
    Last Post: 21-04-2011, 04:21 PM
  5. Retrieve a web page content in java
    By New ID in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 04:09 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,020,299.00117 seconds with 17 queries