west555
Senior Member
- Dec 4, 2011
- 1,004
- 455
I got this bot coded for myself but am not using it anymore
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
PHP:
<?php
$comment = "sdsdws";
$filename = "tokens.txt";
$file = fopen($filename, "r");
while(!feof($file)) {
$tokens[] = fgets($file, 4096);
}
fclose ($file);
$filename = "pages.txt";
$file = fopen($filename, "r");
while(!feof($file)) {
$pages[] = fgets($file, 4096);
}
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($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_URL, "$url");
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $agent);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_REFERER, "https://facebook.com");
// 1 second for a connection timeout with curl
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
// Try using this instead of the php set_time_limit function call
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$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
Last edited: