Exemplo n.º 1
0
    public function testGenTrackingUccClickUrl()
    {
        $kt = new Kontagent(self::KT_HOST, self::KT_API_KEY);
        $st1 = 'st1111';
        $st2 = 'st2222';
        $st3 = 'st3333';
        $kt_url = 'http://apps.facebook.com/lih_test_lowlevelnew/?kt_type=ad&kt_st1='.$st1.'&kt_st2='.$st2.'&kt_st3='.$st3;
        $this->setupServerAndGetVar($kt_url);

        $url = $kt->gen_tracking_ucc_click_url('54321', 'deadbeaf');
        echo $url;
        $items_arry = parse_url($url);
        $tmp_path_arry = split('/', $items_arry['path']);
        $len = sizeof($tmp_path_arry);
        $this->assertEquals( $tmp_path_arry[$len-2], 'ucc',
                             'the message type needs to be ucc');
        parse_str($items_arry['query'], $r_GET_arry);

        $this->assertEquals( $r_GET_arry['tu'], "ad",
                             'should be an ad type' );
        $this->assertEquals( isset($r_GET_arry['su']), true,
                             'the short tag needs to be there.' );
        $this->assertEquals( $r_GET_arry['st1'], $st1,
                             'st1 doesnt match');
        $this->assertEquals( $r_GET_arry['st2'], $st2,
                             'st2 doesnt match');
        $this->assertEquals( $r_GET_arry['st3'], $st3,
                             'st3 doesnt match');
        
    }
Exemplo n.º 2
0
require_once '../kt/php/kontagent.php';
require_once '../kt/php/kt_facebook.php';
require_once '../kt/php/kt_landing.php';

$canvas_url = FB_CANVAS_URL;
$canvas_callback_url = FB_CALLBACK_URL;

// Create our Application instance.
$facebook = new KtFacebook(array('appId'  => FB_ID,
                                 'secret' => FB_SECRET,
                                 'cookie' => true,
                                 )
                           );

// Create a kontagent instance
$kt = new Kontagent(KT_API_SERVER, KT_API_KEY, SEND_MSG_VIA_JS);

//$session = $facebook->fbNativeAppRequireLogin(array('req_perms'=>'publish_stream,user_birthday,user_relationships',
//                                                    'display'=>'popup')); //lihchen

$session = $facebook->fbNativeAppRequireLogin(array('canvas'=>1, 'fbconnect'=>0,
                                                    'req_perms'=>'publish_stream,user_birthday,user_relationships')); //lihchen


// We may or may not have this data based on a $_GET or $_COOKIE based session.
//
// If we get a session here, it means we found a correctly signed session using
// the Application Secret only Facebook and the Application know. We dont know
// if it is still valid until we make an API call using the session. A session
// can become invalid if it has already expired (should not be getting the
// session back in this case) or if the user logged out of Facebook.
Exemplo n.º 3
0
<?php
require_once '../../src/facebook.php'; // replace this with YOUR facebook.php path
require_once 'kt_config.php';
require_once 'kontagent.php';
require_once 'kt_facebook.php';

// http://bugs.developers.facebook.com/show_bug.cgi?id=10567
$facebook = new KtFacebook(array('appId'  => FB_ID,
                                 'secret' => FB_SECRET,
                                 'cookie' => true,
                                 )
                           );
$signed_req = $facebook->getSignedRequest();

$kt = new Kontagent(KT_API_SERVER, KT_API_KEY, SEND_MSG_VIA_JS);
$kt->track_uninstall($signed_req['user_id']); 
Exemplo n.º 4
0
 * @link http://www.kontagent.com
 */

  //
  // Assumption: Whereever kt_landing.php is included,
  // facebook.php and kontagent.php have already
  // been included prior to the loading of this file.
  // 

$facebook = new KtFacebook(array('appId'  => FB_ID,
                                 'secret' => FB_SECRET,
                                 'cookie' => true,
                                 )
                           );

$kt = new Kontagent(KT_API_SERVER, KT_API_KEY, SEND_MSG_VIA_JS);


echo "<script>var KT_API_SERVER = '".KT_API_SERVER."';  var KT_API_KEY = '".KT_API_KEY."';</script>";


$uid = null;
$session = $facebook->getSession();
if($session){
    try{
        $uid = $session['uid'];
    } catch (FacebookApiException $e) {
        error_log($e);
    }
}