OAuthToken.php 673 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class OAuthToken {
  3. // access tokens and request tokens
  4. public $key;
  5. public $secret;
  6. /**
  7. * key = the token
  8. * secret = the token secret
  9. */
  10. function __construct($key, $secret) {
  11. $this->key = $key;
  12. $this->secret = $secret;
  13. }
  14. /**
  15. * generates the basic string serialization of a token that a server
  16. * would respond to request_token and access_token calls with
  17. */
  18. function to_string() {
  19. return "oauth_token=" .
  20. oauthutil::urlencode_rfc3986($this->key) .
  21. "&oauth_token_secret=" .
  22. oauthutil::urlencode_rfc3986($this->secret);
  23. }
  24. function __tostring() {
  25. return $this->to_string();
  26. }
  27. }