Exemplo n.º 1
0
 print "<b>Resetting access token</b>\n";
 $app->setAccessToken($token);
 print "<b>Attempting access again (this should work this time)...</b>";
 print '<blockquote>';
 $allowed = $app->getUser();
 if (!$allowed || !isset($allowed['name']) || $allowed['name'] != $data['name']) {
     print " error getting access again\n";
     var_dump($allowed);
     exit;
 }
 print "Success! We were granted access\n";
 print '</blockquote>';
 print "<b>Attempting to post a test message to app.net...</b>\n";
 print "<blockquote>";
 $sampleText = "Testing posting to app.net using AppDotNetPHP - " . uniqid(mt_rand(0, 100000));
 $create = $app->createPost($sampleText);
 // we should now have a post ID and the text should be the same as above
 if (!$create || !$create['id'] || $create['text'] != $sampleText) {
     print "Error posting sample text to ADN\n";
     var_dump($create);
     exit;
 }
 print "Successfully posted to ADN, post ID is " . $create['id'] . "\n";
 print "</blockquote>";
 // try fetching the post
 print "<b>Attempting to fetch sample post from app.net...</b>\n";
 print "<blockquote>";
 $get = $app->getPost($create['id']);
 if (!$get || !$get['id'] || $get['id'] != $create['id'] || $get['text'] != $sampleText) {
     print "Error fetching sample post from ADN:\n";
     var_dump($get);