コード例 #1
0
ファイル: tests.php プロジェクト: noahm/kontagent-php-sdk
    public function testGenTrackingInviteSentUrl()
    {
        $kt = new Kontagent(self::KT_HOST, self::KT_API_KEY);
        $kt_url = 'http://apps.facebook.com/lih_test_lowlevelnew/?kt_type=ins&kt_ut=6114be4c5ecb69e4&kt_uid=1166673718&kt_st1=st111&kt_st2=st222&kt_st3=st333';        

        $this->setupServerAndGetVar($kt_url);
        $_GET['ids'] = array('1111','2222'); 
        $url = $kt->gen_tracking_invite_sent_url();
        
        $items_arry = parse_url($url);
        parse_str($items_arry['query'], $r_GET_arry);
        $this->assertEquals( isset($r_GET_arry['s']), true,
                             "s is required." );
        $this->assertEquals( isset($r_GET_arry['u']), true,
                             "u is required." );
        $this->assertEquals( strlen($r_GET_arry['u']), 16,
                             "u size should be 16." );
        $this->assertEquals( isset($r_GET_arry['st1']), true,
                             'st1 should be there.');
        $this->assertEquals( isset($r_GET_arry['st2']), true,
                             'st2 should be there.');
        $this->assertEquals( isset($r_GET_arry['st3']), true,
                             'st3 should be there.');
        
        $this->setupServerAndGetVar($kt_url);
        $_GET['ids'] = array('111111','2222222'); 
        $kt->track_invite_sent();
    }
コード例 #2
0
//
// Track other messages
//

if(isset($_GET['kt_type']))
{
    switch($_GET['kt_type'])
    {
    case 'ins':
    {
        if(!$kt->get_send_msg_from_js()){
            $kt->track_invite_sent();
        }else{
            echo "<script>var kt_landing_str='".
                $kt->gen_tracking_invite_sent_url().
                "';</script>";
        }

        
        // If your user gets forwarded outside of facebook,
        // call $facebook->redirect([canvas url]) to forward your
        // user back. 
        // $facebook->redirect(FB_CANVAS_URL);
        break;
    }
    case 'inr':
    {
        error_log($_SERVER['HTTP_REFERER']);//xxx
        if(!$kt->get_send_msg_from_js()){
            $kt->track_invite_received($uid);