expose the req_token() generator & examples/ test script

This commit is contained in:
Thomas Lackner 2013-01-06 23:29:49 -06:00
parent 87222b1fda
commit f10951cd03
2 changed files with 30 additions and 0 deletions

27
examples/req_token.php Normal file
View file

@ -0,0 +1,27 @@
<?
// try to generate req_tokens from the command line
require('../snaphax.php');
function main() {
global $argv;
if (count($argv) != 5) {
die("$argv[0]: usage $argv[0] [user] [pass] [param1] [param2]\n");
}
$opts = array();
$opts['username'] = $argv[1];
$opts['password'] = $argv[2];
$opts['debug'] = 1;
$s = new Snaphax($opts);
$req_token = $s->reqToken($argv[3], $argv[4]);
echo "req_token for $argv[3] $argv[4]:\n";
var_dump($req_token);
$req_token = $s->reqToken($argv[4], $argv[3]);
echo "req_token for $argv[4] $argv[3]:\n";
var_dump($req_token);
}
main();

View file

@ -85,6 +85,9 @@
$this->auth_token);
return $blob;
}
function reqToken($param1, $param2) {
return $this->api->hash($param1, $param2);
}
}
class SnaphaxApi {