I have a code as below, but I am not sure where that class OAuth should be defined. Any link to download the full library so I can use it in my host server by just calling it with "new"?
define('OAUTH_CONSUMER_KEY', 'key);
define('OAUTH_CONSUMER_SECRET', 'secret');
$oauth = new OAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
'oob');
print_r($req_token);
$login_url = sprintf(
"%s?oauth_consumer_key=%s&oauth_token=%s",
$req_token['login_url'],
$req_token['oauth_consumer_key'],
$req_token['oauth_token']
);
print "go to this url: ".$login_url."\n";
print "then tell me what the verifier code you get back is: \n";
$handle = fopen("php://stdin","r");
$line = fgets($handle);
$request_token = $req_token['oauth_token'];
$request_token_secret = $req_token['oauth_token_secret'];
$verifier = trim($line);
print "you said {$verifier}\n";
print "now let's see what we can get back from Etsy...";
$oauth->setToken($request_token, $request_token_secret);
try {
$access_token =
null, $verifier);
} catch (OAuthException $e) {
print_r($e->getMessage());
}
$oauth_token = $access_token['oauth_token'];
$oauth_token_secret = $access_token['oauth_token_secret'];
$oauth->setToken($oauth_token, $oauth_token_secret);
try {
$json = $oauth->getLastResponse();
print_r(json_decode($json, true));
} catch (OAuthException $e) {
error_log($e->getMessage());
error_log(print_r($oauth->getLastResponse(), true));
error_log(print_r($oauth->getLastResponseInfo(), true));
exit;