Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store token in a flat file #3

Closed
Michael1969 opened this issue Sep 28, 2013 · 2 comments
Closed

store token in a flat file #3

Michael1969 opened this issue Sep 28, 2013 · 2 comments

Comments

@Michael1969
Copy link

Hi,
its not an issue.

In init.php I want to store the token in a flat file.
Do I have to store the access token and request token for listings?
Is there an example?

Thanks, Michael

@Michael1969
Copy link
Author

function retrieve_token($oauth_token_type)
{
var_dump($oauth_token_type);
@session_start();
if(!isset($_SESSION['TradeMe'])) $_SESSION['TradeMe'] = array();
$file = 'token.txt';

  $content = unserialize(file_get_contents($file));
  $_SESSION['TradeMe'][$oauth_token_type] = $content;

  if(!isset($_SESSION['TradeMe'][$oauth_token_type]))
  {
    throw new Exception('You have not stored a '.$oauth_token_type.' token, you probably need to hit connect.php');
  }
  return @$_SESSION['TradeMe'][$oauth_token_type];
}

@sleemanj
Copy link
Owner

store_token() and retrieve_token() must both be able to handle request or access tokens, both should be stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants