Untuk referesh token facebook, agan butuh username/email dan password fb untuk refresh token. brikut ini scriptnya:
<?php
$user="username_atau_email_fb"; //isi username/email fb kalian
$pass="Z2VudG9vbGludXg="; //isi password fb kalian yg dah diencode ama base64
$data = "email=".$user."&pass=".base64_decode($pass)."&login=Masuk";
$asu = curl("https://m.facebook.com/login.php", $data);
$asu = curl("https://www.facebook.com/dialog/oauth?response_type=token&display=popup&client_id=145634995501895&redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer%2Fcallback&scope=user_actions.books%2Cuser_actions.music%2Cuser_actions.video%2Cuser_checkins%2Cuser_education_history%2Cuser_events%2Cuser_games_activity%2Cuser_groups%2Cuser_hometown%2Cuser_interests%2Cuser_likes%2Cuser_location%2Cuser_notes%2Cuser_photo_video_tags%2Cuser_photos%2Cuser_questions%2Cuser_relationship_details%2Cuser_relationships%2Cuser_religion_politics%2Cuser_status%2Cuser_subscriptions%2Cuser_videos%2Cuser_website%2Cuser_work_history%2Cfriends_about_me%2Cfriends_actions.books%2Cfriends_actions.music%2Cfriends_actions.news%2Cfriends_actions.video%2Cfriends_activities%2Cfriends_birthday%2Cfriends_checkins%2Cfriends_education_history%2Cfriends_events%2Cfriends_games_activity%2Cfriends_groups%2Cfriends_hometown%2Cfriends_interests%2Cfriends_likes%2Cfriends_location%2Cfriends_notes%2Cfriends_photo_video_tags%2Cfriends_photos%2Cfriends_questions%2Cfriends_relationship_details%2Cfriends_relationships%2Cfriends_religion_politics%2Cfriends_status%2Cfriends_subscriptions%2Cfriends_videos%2Cfriends_website%2Cfriends_work_history%2Cads_read%2Cemail%2Cpublish_checkins");
$gay = preg_match("/access_token=(.*?)&expires_in/i", $asu, $m);
$fp = fopen("token.txt", 'w') or die("gay");
fwrite($fp, $m[1]);
fclose($fp);
echo $m[1];
function curl($url, $post=null){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($post!=null){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:28.0) Gecko/20100101 Firefox/28.0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
//curl_setopt($ch, CURLOPT_VERBOSE, true);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
?>
jalankan lalu tokennya akan disimpan di file
token.txt. Jika gak bisa, itu mungkin waktu login dicegat ama message “Simpan Browser/Jangan Simpan Browser”. nonaktifkan message tersebut
Cara pakeknya gimana? Dipanggil di localhost tiap 24 jam sekali?
BalasHapus