Last active
February 3, 2016 01:08
-
-
Save sniper7kills/560be2f1f94637da7e60 to your computer and use it in GitHub Desktop.
A Facebook PokeWar Bot Written In PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// your facebook credentials | |
$username = "FACEBOOK_USERNAME_OR_PHONE_NUMBER"; | |
$password = "FACEBOOK_PASSWORD"; | |
// login to facebook | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://m.facebook.com/login.php'); | |
curl_setopt($ch, CURLOPT_POSTFIELDS,'charset_test=€,´,€,´,水,Д,Є&email='.urlencode($username).'&pass='.urlencode($password).'&login=Login'); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Charset: utf-8','Accept-Language: en-us,en;q=0.7,bn-bd;q=0.3','Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5')); | |
curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd () . '/cookies.txt'); | |
curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd () . '/cookies.txt' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_USERAGENT, "user_agent"); | |
curl_setopt($ch, CURLOPT_REFERER, "http://m.facebook.com"); | |
$fbMain = curl_exec($ch) or die(curl_error($ch)); | |
// enter infinite poke loop | |
while(true){ | |
curl_setopt ( $ch, CURLOPT_URL, "https://m.facebook.com/pokes" ); | |
$pokeData = curl_exec ( $ch ); | |
preg_match_all("/<a href=\"(.*?)\">([^<]*)<\/a> poked you/",$pokeData,$names,PREG_SET_ORDER); | |
preg_match_all("/<a class=\"(.*?)\" href=\"\/pokes\/inline\/(.*?)\"/",$pokeData,$links,PREG_SET_ORDER); | |
if(count($names)>0){ | |
for($x=0;$x<count($names);$x++) | |
{ | |
echo $names[$x][2]." Poked You!\n"; | |
curl_setopt ( $ch, CURLOPT_URL, "https://m.facebook.com/pokes/inline/".htmlspecialchars_decode($links[$x][2])); | |
$poked = curl_exec($ch) or die(curl_error($ch)); | |
echo "You Poked Back!\n"; | |
} | |
} | |
else{ | |
sleep(3); | |
} | |
empty($names); | |
empty($links); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment