if ($action == "authorized") { $request_token = new OAuthConsumer($_SESSION['request_token_key'], $_SESSION['request_token_secret']); $response = $app->getAccessToken($request_token, $_GET['oauth_verifier']); parse_str($response, $params); $access_token = $params['oauth_token']; $access_token_secret = $params['oauth_token_secret']; $_SESSION['ACCESS_TOKEN'] = $access_token; $_SESSION['ACCESS_TOKEN_SECRET'] = $access_token_secret; } else { if ($action == "post") { $token = new OAuthToken($_SESSION['ACCESS_TOKEN'], $_SESSION['ACCESS_TOKEN_SECRET']); $app->token = $token; /* Congratulations! You've just logged in into Yahoo! and now are able to * post on meme :P' */ $meme = new MemeRepository(); $meme->insert($app, $_REQUEST['post_type'], $_REQUEST['content'], isset($_REQUEST['caption']) ? $_REQUEST['caption'] : null); print "<h1>CONGRATS! YOU DID IT</h1>"; } } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Yahoo! Meme posting example!</title> </head> <body> <p>The goal of this example is to show you how to add content to Meme using your own app ;P</p> <form name="post_text" method="GET"> <input type="hidden" name="action" value="post" /> <select name="post_type">
if ($action == "authorized") { $request_token = new OAuthConsumer($_SESSION['request_token_key'], $_SESSION['request_token_secret']); $response = $app->getAccessToken($request_token, $_GET['oauth_verifier']); parse_str($response, $params); $access_token = $params['oauth_token']; $access_token_secret = $params['oauth_token_secret']; $_SESSION['ACCESS_TOKEN'] = $access_token; $_SESSION['ACCESS_TOKEN_SECRET'] = $access_token_secret; $content = $_SESSION['full_content']; $caption = $_SESSION['full_caption']; $token = new OAuthToken($_SESSION['ACCESS_TOKEN'], $_SESSION['ACCESS_TOKEN_SECRET']); $app->token = $token; /* Congratulations! You've just logged in into Yahoo! and now are able to * post on meme :P' */ $meme = new MemeRepository(); $meme->insert($app, $_REQUEST['post_type'], $content, isset($caption) && !empty($caption) ? $caption : null); print "<h1>CONGRATS! YOU DID IT (or not.. You'd better double check :P)</h1>"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Yahoo! Meme posting example!</title> </head> <body> <p>The goal of this example is to show you how to add content to Meme using your own app ;P</p> <form name="post_text" method="GET"> <input type="hidden" name="action" value="request_token" /> <select name="post_type"> <option value="text" <?php