diff --git a/examples/php/live/authentication/common.php b/examples/php/live/authentication/common.php new file mode 100644 index 00000000..05873f77 --- /dev/null +++ b/examples/php/live/authentication/common.php @@ -0,0 +1,19 @@ +getAccessToken(constant('ACCESS_TOKEN')); + + $_SESSION['accessToken'] = $consumer->getToken(); + $_SESSION['accessTokenSecret'] = $consumer->getTokenSecret(); + + header('Location:index.php'); +} catch (Exception $e) { + ?> +

Authorization failed!

+

Go back

+ getRequestToken(constant('REQUEST_TOKEN'), constant('BASE_URL').'/getAccessToken.php'); + +$_SESSION['token'] = $consumer->getToken(); +$_SESSION['tokenSecret'] = $consumer->getTokenSecret(); + +$url = $consumer->getAuthorizeUrl(constant('AUTHORIZE_TOKEN')); +header('Location:'.$url); diff --git a/examples/php/live/authentication/index.php b/examples/php/live/authentication/index.php new file mode 100644 index 00000000..a0a78db9 --- /dev/null +++ b/examples/php/live/authentication/index.php @@ -0,0 +1,47 @@ +We have no access token, connect us +

We have access!

+

+ In your system, store these values to do requests for this user:
+ Token:
+ Secret: +

+

Clear the token and restart

+

List users devices

+ constant('TELLSTICK_TURNON') | constant('TELLSTICK_TURNOFF'), + ); + $response = $consumer->sendRequest(constant('REQUEST_URI').'/devices/list', $params, 'GET'); + echo '
';
+	echo( htmlentities($response->getBody()));
+}
+
+?>

List users clients

sendRequest(constant('REQUEST_URI').'/clients/list', $params, 'GET'); + echo '
';
+	echo( htmlentities($response->getBody()));
+}
+
+