1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GIVEAWAY] Bacebook token comment bot PHP

Discussion in 'PHP & Perl' started by west555, Oct 31, 2014.

  1. west555

    west555 Regular Member

    Joined:
    Dec 4, 2011
    Messages:
    326
    Likes Received:
    130
    Location:
    /etc/passwd
    I got this bot coded for myself but am not using it anymore

    PHP:
    <?php


    $comment 
    "sdsdws";

    $filename "tokens.txt";
    $file fopen($filename"r");
    while(!
    feof($file)) {
    $tokens[] = fgets($file4096);
    }
    fclose ($file);

    $filename "pages.txt";
    $file fopen($filename"r");
    while(!
    feof($file)) {
    $pages[] = fgets($file4096);
    }
    fclose ($file);


    //$tokens = "";



    //$pages = "";

    $tokens explode(","$tokens);
    $pages explode(","$pages);
    sort($tokens);

    $Pi count($pages);
    $ii 0;
    $checkii 0;
    while(
    $Pi $ii) {


    $i 0;
    $Ai count($tokens);



    while(
    $Ai $i){



    /* get post id */

    $getinfo httphit("https://graph.facebook.com/" $pages[$ii] . "/feed?fields=id,from,type,message&limit=100&access_token="$tokens[$i]);


    $getinfo explode('"name"'$getinfo);
    $getinfo explode('"id:"'$getinfo[0]);
    $getinfo explode('"'$getinfo[0]);
    $post_id $getinfo[5];
    //print $post_id;
    $check httphit("https://graph.facebook.com/" $post_id "/comments?method=POST&message=" $comment "&access_token="$tokens[$i]);
    /*done*/





    if(strpos($check$post_id) ){
    $i++;
    $ii++;
    } else {
    unset(
    $tokens[$i]);
    sort($tokens);
    $i++;
    }

    sleep(5);
    }

    }


    foreach(
    $tokens as $token){
        
        print 
    $token "<br />";
    }
    print 
    $ii;



    function 
    httphit($url){
    $agent "Mozilla/5.0 (X11; Linux i686 on x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1";
    $headers=array("Content-Type: application/x-www-form-urlencoded;  charset=UTF-8","DNT: 1","Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language: en-US,en;q=0.5","Accept-Encoding: gzip, deflate");
    $curl curl_init();

    curl_setopt($curlCURLOPT_ENCODING'gzip,deflate');
    curl_setopt($curlCURLOPT_URL"$url");
    curl_setopt($curlCURLOPT_SSL_VERIFYHOST1);
    curl_setopt($curlCURLOPT_SSL_VERIFYPEERFALSE);
    //curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curlCURLOPT_USERAGENT$agent);
    curl_setopt($curlCURLOPT_HTTPHEADER$headers);
    curl_setopt($curlCURLOPT_REFERER"https://facebook.com");
    // 1 second for a connection timeout with curl
    curl_setopt($curlCURLOPT_CONNECTTIMEOUT5);

    // Try using this instead of the php set_time_limit function call
    curl_setopt($curlCURLOPT_TIMEOUT60);
    curl_setopt($curlCURLOPT_RETURNTRANSFER1);

    $result curl_exec($curl);

    return 
    $result;
    }



    ?>

    Using :
    You will need to have 2 txt files in the same folder
    tokens.txt and pages.txt


    for pages you will need to enter main link of the page (not post url) as bot will find which is the latest post and make comment on it

    Make sure you use fresh tokens else your post might get ghosted
     
    • Thanks Thanks x 1
    Last edited: Nov 1, 2014
  2. nirose

    nirose Senior Member

    Joined:
    Oct 24, 2008
    Messages:
    984
    Likes Received:
    437
    Location:
    somake.us
    Bacebook!!

    hehehe
     
  3. west555

    west555 Regular Member

    Joined:
    Dec 4, 2011
    Messages:
    326
    Likes Received:
    130
    Location:
    /etc/passwd
    Hahahaha I was posting from mobile, didn't noticed Autocorrect messed that up
     
  4. EnzBots

    EnzBots Junior Member

    Joined:
    Aug 25, 2013
    Messages:
    145
    Likes Received:
    67
    I have some dumb questions but others might have the same...

    1: where do you get the tokens and do you have lines of them or just one in the txt?
    2: where do you get tokens?

    thanks for the share!!
     
  5. west555

    west555 Regular Member

    Joined:
    Dec 4, 2011
    Messages:
    326
    Likes Received:
    130
    Location:
    /etc/passwd
    as for adding tokens you add them to txt like each token on new line, no (,) or anything between them
    as for getting tokens you can ether purchase them from sellers, use fb apps to get them, or extract from pages you make (i think there was tutorial for the last one posted somewhere on forum)