Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
script auto reply mentions di twitter by me
#1
1. pertama, agan hrus udah punya file OAuth.php dan twitteroauth.php yg bisa didownload 1 paket di sini
klo males download bisa langsung ambil 2 filenye lewat pastebin
OAuth.php -> http://pastebin.com/AusVevKV
twitteroauth.php -> http://pastebin.com/5XsgH8p2
trus jgn lupa ganti akses dari Read ke Read and Write di menu setting yg ada di app twitter agan,,

2. taruh 2 file tadi dalam 1 folder, trus buat file auto_reply_mention.php dalam folder itu juga
dan ksih script kya gini
PHP Code:
<?php /* coded by rieqyns13 thanks to all indonesian coder */ set_time_limit(0); class rieqyns13{ public $api_key; public $api_secret; public $access_token; public $access_token_secret; public $simi_type; public $file_id; public $file_log; public $delay; public $fls_komen; public $post_waktu; public $cookie; private $user_sender; private $user_mention; function oauth(){ require_once("lib/twitteroauth.php"); $con = new TwitterOAuth($this->api_key, $this->api_secret, $this->access_token, $this->access_token_secret); return $con; } function tweet(){ $con = $this->oauth(); $data = $con->get("statuses/mentions_timeline"); return $data; } function tweet2(){ $con = $this->oauth(); foreach($this->tweet() as $twit){ if($this->cekId($twit->id_str)==true){ $user_mention = explode(" ", $twit->entities->user_mentions[0]->name); $this->user_mention = $user_mention[0]; $user_sender = explode(" ", $twit->user->name); $this->user_sender = $user_sender[0]; if($this->post_waktu==true) $waktu = $this->waktu(); else $waktu = null; if($this->simi_type==true) $data = "@".$twit->user->screen_name." ".$this->simsimi($twit->text).$waktu; else{ $msg = $this->match($this->fls_komen); $data = "@".$twit->user->screen_name." ".$msg.$waktu; } echo "[+]Menangkap mention dari @".$twit->user->screen_name.": ".$twit->text."\n"; echo "[+]Mencoba membalas: "; $post = $con->post("statuses/update", array("status" => $data, "in_reply_to_status_id" => $twit->id_str)); if(!empty($post->text)){ $status = "Sukes -> ".$post->text."\n"; echo $status; $this->simpan($this->file_log, $status); $this->simpan($this->file_id, $twit->id_str."\n"); }elseif(!empty($post->errors[0]->message)){ $status = "Gagal -> ".$post->errors[0]->message."\n"; $this->simpan($this->file_id, $twit->id_str."\n"); //<<--test echo $status; $this->simpan($this->file_log, $status); } }else{ continue; } } } function waktu(){ if(function_exists('date_default_timezone_set')) date_default_timezone_set("Asia/Jakarta"); $hari=date('w'); $tgl =date('d'); $bln =date('m'); $thn =date('Y'); $jam =date("H:i:s"); switch($hari){ case 0 : {$hari='Sunday';}break; case 1 : {$hari='Monday';}break; case 2 : {$hari='Tuesday';}break; case 3 : {$hari='Wednesday';}break; case 4 : {$hari='Thursday';}break; case 5 : {$hari="Friday";}break; case 6 : {$hari='Saturday';}break; default: {$hari='UnKnown';}break; } switch($bln){ case 1 : {$bln='January';}break; case 2 : {$bln='February';}break; case 3 : {$bln='March';}break; case 4 : {$bln='April';}break; case 5 : {$bln='May';}break; case 6 : {$bln="June";}break; case 7 : {$bln='July';}break; case 8 : {$bln='August';}break; case 9 : {$bln='September';}break; case 10 : {$bln='October';}break; case 11 : {$bln='November';}break; case 12 : {$bln='December';}break; default: {$bln='UnKnown';}break; } $waktu = "\n[".$hari.", ".$tgl." ".$bln." ".$thn." ".$jam."]"; return $waktu; } function match($str){ if(preg_match("#@nama_saya#is", $str)) $str = str_ireplace("@nama_saya", $this->user_mention, $str); else $str = $str; if(preg_match("#@nama_depan#is", $str)) $str = str_ireplace("@nama_depan", $this->user_sender, $str); else $str = $str; return $str; } function simsimi($str){ $header = array("Host: www.simsimi.com", "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0", "Accept: application/json, text/javascript, */*; q=0.01", "Accept-Language: id,en-us;q=0.7,en;q=0.3", "Accept-Encoding: gzip, deflate", "Content-Type: application/json; charset=utf-8", "X-Requested-With: XMLHttpRequest", "Referer: http://www.simsimi.com/talk.htm", "Cookie: ".$this->cookie); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.simsimi.com/func/reqN?lc=id&ft=0.0&req=".urlencode($str)); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $exec = curl_exec($ch); curl_close($ch); $dec = json_decode($exec, true); if(empty($dec)){ $msg = $this->fls_komen; $simi = $this->match($msg); return $simi; }else{ if(!empty($dec['sentence_resp'])){ $dat = $dec['sentence_resp']; if(preg_match("/is tired/is", $dat)){ $msg = $this->match($this->fls_komen); //$simi=$msg; $simi = $msg.$this->waktu(); }else $simi=$dat."\n#BotMaho"; }else{ $msg = $this->fls_komen; $simi = $this->match($msg); //return $simi; $simi = $simi.$this->waktu(); } $preg = preg_replace("/simsimi|simi|.simi|sim/i", " rieqy", $simi); return $preg; } } function simpan($file, $data){ $fp = fopen($file, "a"); fwrite($fp, $data); fclose($fp); } function cekId($id){ if(!file_exists($this->file_id)){ $this->simpan($this->file_id, ""); } if(file_exists($this->file_id)){ $file = file($this->file_id); $file = str_replace(array("\n", "\r", "\r\n"), "", $file); $file = array_unique($file); if(in_array($id, $file)==true){ return false; }else{ return true; } } } } $bot = new rieqyns13; $bot->cookie=" COOKIENYA CARI SENDIRI GAN"; $bot->api_key="***************"; $bot->api_secret="***************"; $bot->access_token="***************"; $bot->access_token_secret="***************"; $bot->file_id = "mention_id.log"; $bot->file_log = "mention.log"; $bot->simi_type = true; //TRUE jika ingin menggunakan api simsimi untuk reply mentions, FALSEE jika ingin membalas mention dengan pesan sendiri di $bot->fls_komen; $bot->fls_komen = "kak @nama_depan, om @nama_saya lagi off, jdi yg bales robotnya"; $bot->post_waktu = false; $bot->delay = 1; $bot->tweet2(); ?>
jgn lupa buat file txt dulu yaitu log_id.txt dan log_bot.txt sesuai dgn $bot->file_id dan $bot->file_log yg dibuat. trus di chmod 0777 kedua file txt tdi biar filenya bisa dibaca dan ditulis.
trus tinggal atur cron job

oh ya, kan ada tulisan @nama_depan di bagian $bot->fls_komen, itu untuk nampilin nama depan user yg mention kita. jdi klo mw nampilin nama depan dri user yg mention kita, tinggal tambahin @nama_depan aja di bagian $bot->fls_komen

Hasilnya gan
[Image: jZ9FHxQ.png]
dan ini log nya -> http://epomia.com/tmp/log_bot.txt
gue homo, thanks Santet
Reply
#2
wih bagusan banget nih posting udah lama nyari yang beginian makasih om Bahagia
Reply
#3
saatnya masukin postingan ini jadi daftar bookmark (y) (bahagia)
Quote:Camfroger Indonesia
Server : J.A.M.5 (general room) & QPS (18+ room)
NickName : Vocer, felixkeren28, felix_lovers, EropeanAdminServer, sihomo, sisurem

http://www.speedtest.net/my-result/3081452659
Reply
#4
nah ni baru manteb (y)

share script Bahagia

Cendol Melayang . Cek Kulkas ^_^
Quote:
Pensiun Dunia Hacking [ UDAH KAPOK ] - mohon maaf lahir dan batin - yang lalu biarlah berlalu ...
Reply
#5
subscribe dulu ya om Bahagia lumayan nih :)

[Image: 467898856656158]
Quote:The closer you look, the less you'll see.
-=[ irc.hacker-newbie.org ]=-
Reply
#6
trus jgn lupa ganti akses dari Read ke Read and Write di menu setting yg ada di app twitter agan,,

ni maksudnya gimana gan? ane ga ngerti.. Bingung
maklum.. newbie masih dalam proses Belajar
Reply
#7
(08-05-2013, 04:25 AM)azhariejaya Wrote: trus jgn lupa ganti akses dari Read ke Read and Write di menu setting yg ada di app twitter agan,,

ni maksudnya gimana gan? ane ga ngerti.. Bingung
maklum.. newbie masih dalam proses Belajar
agan buat app dlu di twitter, trus pilih Home -> My applications -> tab Settings
[Image: 3UyrKjH.png]
trus pada Application Type ganti ke Read and Write
[Image: o6f96Vs.png]
gue homo, thanks Santet
Reply
#8
@RieqyNS13, thanks tutorny gan, maap jga udah ngerepotin :D

Quote:[Image: 111.png]

maap bw killer Takut

klo error :
Code:
The program can’t start because php_mbstring.dll is missing from your computer PHP The program can’t start because dll is missing from your computer. Try reinstalling the program to fix this problem.

atau

Code:
PHP Warning: PHP Startup: Unable to load dynamic library ‘F:/AppServ\php5\ext\p hp_exif.dll’ – The specified module could not be found.

edit file php.ini, dari :
Code:
extension=php_exif.dll extension=php_mbstring.dll

jadi :
Code:
extension=php_mbstring.dll extension=php_exif.dll

kenapa kyk gitu? jgn tanya ane ane kgk tau Garing
Reply
#9
bro, bsa buat bot twitter reply dgn keyword ga? klo bsa tlong buating ya :D
Reply
#10
Nah, ini nih yang gue cari²Mantab
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Wah-yellow_16 Twitter Bootstrap - Just drag and Drop hexagon 7 109 09-27-2014, 06:04 AM
Last Post: Up_
  [ASK] Script php Bunglon_Ijo 4 67 09-27-2014, 03:00 AM
Last Post: Bunglon_Ijo
  [SHARE] Tempat Upload Tool , Jalankan Script dll vba 14 337 08-10-2014, 05:20 AM
Last Post: positive
  Script PHP Upload File From URL CopSLacS 6 173 08-10-2014, 05:08 AM
Last Post: positive
  butuh java script email dhiany 8 77 08-10-2014, 05:01 AM
Last Post: positive
  [tutor]script auto retweet & favorite di twitter menurut keyword :p RieqyNS13 14 438 08-09-2014, 05:35 PM
Last Post: positive
  Ask : add ons buat pasang script adsense ke browser lugiyatna 3 42 02-28-2014, 05:01 AM
Last Post: lugiyatna
  [Ask] script php membaca isi database Terakhir roisbwi 3 74 10-29-2013, 02:43 PM
Last Post: hogyz
  [Share] Script PHP Web Proxy Untuk Web Hosting CopSLacS 9 174 09-24-2013, 10:36 AM
Last Post: CopSLacS
  (script)Bing subdomain scanner RieqyNS13 8 133 08-08-2013, 01:29 AM
Last Post: arDhi^_

Forum Jump:


Users browsing this thread: 2 Guest(s)