Beispiel #1
0
<?php

include 'lib_oauth.php';
include 'config.php';
##########################################################################################
#
# STEP 1 - get an access token and a URL at which the user can auth it
#
$keys = array('oauth_key' => OAUTH_CONSUMER_KEY, 'oauth_secret' => OAUTH_CONSUMER_SECRET);
$ok = oauth_get_auth_token($keys, OAUTH_REQUEST_URL, array('oauth_callback' => OAUTH_CALLBACK_URL));
if ($ok) {
    $url = oauth_get_auth_url($keys, OAUTH_AUTHORIZE_URL);
    setcookie('my_req_key', $keys[request_key]);
    setcookie('my_req_secret', $keys[request_secret]);
    echo "<a href=\"{$url}\">Connect with Foursquare</a>\n";
    exit;
} else {
    dump_last_request();
}
Beispiel #2
0
	##########################################################################################
	#
	# STEP 1 - get an access token and a URL at which the user can auth it
	#

	$keys = array(
		'oauth_key'		=> 'my-oauth-consumer-key',
		'oauth_secret'		=> 'my-oauth-consumer-secret',
	);

	$ok = oauth_get_auth_token($keys, "http://example.com/request-token-url");

	if ($ok){

		$url = oauth_get_auth_url($keys, "http://example.com/authorize-url");

		echo "access url is $url\n";
		exit;
	}else{
		die("something went wrong");
	}

	# (this step adds two keys to the $keys hash)


	##########################################################################################
	#
	# STEP 2 - exchange the authorized access token for a request token
	#