コード例 #1
0
ファイル: tests.php プロジェクト: noahm/kontagent-php-sdk
    public function testGenInvitePostLink()
    {
        $kt = new Kontagent(self::KT_HOST, self::KT_API_KEY, false);
        $long_tracking_code = $kt->gen_long_tracking_code();
        $uid = '101010';
        $st1_str = 'st1 string';
        $st2_str = 'st2 string';
        $st3_str = 'st3 string';
        
        $invite_post_link = $kt->gen_invite_post_link(self::APP_URL,
                                                      $long_tracking_code,
                                                      $uid,
                                                      $st1_str, $st2_str, $st3_str);

        $url_items = parse_url($invite_post_link);
        parse_str($url_items['query'], $query_items);
        $this->assertEquals($query_items['kt_type'], 'ins',
                             'wrong kt_type for ins');
        $this->assertEquals(strlen($query_items['kt_ut']), 16,
                            'bad kt_ut for ins');
        $this->assertNotNull($query_items['kt_uid'],
                             'kt_uid is not found for ins');
        $this->assertEquals($query_items['kt_st1'], $st1_str,
                            'wrong kt_st1 value for ins');
        $this->assertEquals($query_items['kt_st2'], $st2_str,
                            'wrong kt_st2 value for ins');
        $this->assertEquals($query_items['kt_st3'], $st3_str,
                            'wrong kt_st3 value for ins');
                            
        
        try{
            $invite_post_link = $kt->gen_invite_post_link(self::APP_URL,
                                                          $long_tracking_code,
                                                          $uid,
                                                          null,
                                                          'st2 string',
                                                          'st3 string'
                                                          );
        }
        catch(KontagentException $e)
        {
            $this->assertEquals($e->getMessage(),
                                'In order to supply a st2 string , you must also supply a st1 string',
                                'Unexpected exception msg when a st2 string is supplied without supplying a st1 string');
        }

        try{
            $invite_post_link = $kt->gen_invite_post_link(self::APP_URL,
                                                          $long_tracking_code,
                                                          $uid,
                                                          'st1 string',
                                                          null,
                                                          'st3 string'
                                                          );
        }
        catch(KontagentException $e)
        {
            $this->assertEquals($e->getMessage(),
                                'In order to supply a st3 string , you must also supply a st1 string and a st2 string',
                                'Unexpected exception msg when a st3 string is supplied without supplying a st2 string');
        }
    }
コード例 #2
0
ファイル: index.php プロジェクト: noahm/kontagent-php-sdk
    
    <h3>You</h3>
    <img src="https://graph.facebook.com/<?php echo $uid; ?>/picture">
    <?php echo $me['name']; ?>

    <h3>Your User Object</h3>
    <pre><?php print_r($me); ?></pre>
<?php else: ?>
    <strong><em>You are not Connected.</em></strong>
    <?php endif ?>

<?php
$long_tracking_code = $kt->gen_long_tracking_code();
$st1 = 'st111'; $st2 = 'st222'; $st3 = 'st333';
$invite_post_link = $kt->gen_invite_post_link($canvas_callback_url,
                                              $long_tracking_code,
                                              $uid,
                                              "st111","st222","st333");
$invite_content_link = $kt->gen_invite_content_link($canvas_url,
                                                    $long_tracking_code,
                                                    'st111', 'st222', 'st333');

echo "<p>invite_content_link: ".$invite_content_link."</p>";
echo "<p>invite_post_link   : ".$invite_post_link."</p>";
echo print_r($facebook->getSignedRequest(),1);
?>

<fb:serverFbml>
<script type="text/fbml">
<fb:fbml>
    <fb:request-form
        method='POST'