Exemplo n.º 1
0
 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);
     exit;
 }
 print "Successfully retrieved the sample post from ADN, post ID is " . $get['id'] . "\n";
 print "</blockquote>";
 // try deleting the post
 print "<b>Attempting to delete the sample post from app.net...</b>\n";
 print "<blockquote>";
 $delete = $app->deletePost($create['id']);
 if (!$delete || !$delete['id'] || $delete['id'] != $create['id']) {
     print "Error deleting sample post from ADN:\n";
     var_dump($delete);
     exit;