Created
October 26, 2009 17:17
-
-
Save basdog22/218828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($_SESSION['hasSession'] == FALSE) { | |
// create the callback url, | |
$callback = 'http://www.feed2meme.com/'; | |
// pass the credentials to get an auth url. | |
// this URL will be used for the pop-up. | |
$auth_url = YahooSession::createAuthorizationUrl(CONSUMER_KEY,CONSUMER_SECRET, $callback); | |
}else { | |
// pass the credentials to initiate a session | |
$token = unserialize($_SESSION['session']); | |
if($token) { | |
// Get the currently sessioned user. | |
$user = $token->getSessionedUser(); | |
// Load the profile for the current user. | |
$profile = $user->getProfile(); | |
} | |
} | |
if($hasSession == FALSE) { | |
?> | |
<p>Click on the image below.Confirm that you agree to connect your meme account to Feed2meme and you will be redirected back here again.<br /> | |
<a href="<?php echo $auth_url; ?>"><img src="template/images/yahoo.png" alt="Authenticate with Yahoo!" title="Click Here to Go to Yahoo!" /></a> | |
</p> | |
<?php | |
}else{ | |
$tok = $token->getAccessToken(); | |
$meme = $token->query('select * from meme.info where owner_guid=me'); | |
$token->query('INSERT INTO meme.user.posts (type, content) VALUES ("text", "a text post test!")'); | |
echo "<pre>"; | |
print_r($user); | |
saveOathToken($tok->consumer,$tok->secret,$meme->query->results->meme->name,$_SESSION['session']); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment