Senin, 20 Februari 2012

Jempoler Facebook versi 2


Seiring terus berubahnya source Aplikasi Facebook, terpaksa deh bOt jempol ikut bermutasi…Berhubung tidak bisa di aksesnya API Key di page developer maka kami putuskan untuk merombak source bOt jempol…ahihihihi…
Syarat utama yg diperlukan :

  1. Aplikasi Facebook (API id + API secret)
  2. Ijinkan akses aplikasi untuk melakukan read_stream,publish_stream,dan offline_access :dapat diperoleh melalui :
    1https://m.facebook.com/dialog/permissions.request?app_id=ini_id_aplikasimu&display=wap&next=http%3A%2F%2Fm.facebook.com%2F&response_type=token&perms=publish_stream,read_stream,offline_access
  3. Download PHP- SDK terbaru :PHP-SDK
  4. Coba Kode di bawah ini :
01<?php
02/*
03* Zam@agendosa.com
04* New Version Jempoler
05* 19 Dec 2011
06*/
07require '/sdkfbversi3/facebook.php';
08$facebook = new Facebook(array(
09  'appId'  => '180579888678xxx',
10  'secret' => '7a24c291914e45820a94485288c17xxx',
11));
12 
13$user = '100000013132xxx';
14 
15// Get All Friends
16$get_friend  =   array(
17   'method'  => 'friends.get',
18   'callback' => '',
19   'flid' => '',
20   'uid'       => $user,
21);
22 
23try {
24    $friends = $facebook->api($get_friend);
25} catch (FacebookApiException $e) {}
26 
27if(is_array($friends)){
28    foreach($friends as $uid){
29        // Get Stream Per User
30        $get_stream = array(
31            'method' => 'stream.get',
32            'viewer_id' => $user,
33            'source_ids' => $uid,
34            'limit' => 1,
35        );
36 
37        try {
38            $stream = $facebook->api($get_stream);
39        } catch (FacebookApiException $e) {}
40 
41        if(is_array($stream[posts][0])){
42            if(strcmp((string)$stream[posts][0][actor_id],(string)$uid) == 0){
43                if($stream[posts][0][likes][can_like] == true){
44                    $add_like = array(
45                        'method' => 'stream.addLike',
46                        'uid' => $user,
47                        'post_id' => $stream[posts][0][post_id],
48                    );
49                    try {
50                        $sendlike = $facebook->api($add_like);
51                    } catch (FacebookApiException $e) {}
52                }
53            }
54        }
55    }
56}
57 
58?>
Catatan :
  1. Copy code rename jadi jempol.php (*bebas adikasih nama apa saja,cuma untuk mempermudah saja kok)
  2. Setelah download php SDK, lalu upload di hostingan sesuaikan dengan direktori t4 upload masing².
  3. Ganti source di atas bagian :
    • require ‘/sdkfbversi3/facebook.php‘;
    • ‘appId’  => ‘180579888678xxx‘, << ganti id aplikasi masing².
    • ‘secret’ => ‘7a24c291914e45820a94485288c17xxx‘, << ganti api secret masing².
    • $user = ‘100000013132xxx‘; << ganti dengan uid masing²
  4. Coba akses aplikasi secara langsung :
    http://domain.me/bot/jempol.php dan tunggu hasilnya, biasanya jempol baru nampak di status ke 2 dst…~salam Agen Dosa Crew ~

Tidak ada komentar:

Posting Komentar

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes