forked from abraham/twitteroauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oob1.php
23 lines (18 loc) · 793 Bytes
/
oob1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/**
* Use this script for out-of-bounds twitter oauth login (e.g. for commandline apps)
*
* It is based on redirect.php
*/
/* Start session and load library. */
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
/* Get temporary credentials. */
$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
file_put_contents("oauth_token.dat",serialize($request_token));
/* Build authorize URL and tell user to visit Twitter. */
$url = $connection->getAuthorizeURL($request_token['oauth_token'],$sign_in_with_twitter = TRUE); //For all from a browser
echo "Please visit this URL to authorize the app and get a PIN number:\n $url\n";
?>