expose the req_token() generator & examples/ test script
This commit is contained in:
parent
87222b1fda
commit
f10951cd03
2 changed files with 30 additions and 0 deletions
27
examples/req_token.php
Normal file
27
examples/req_token.php
Normal 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();
|
|
@ -85,6 +85,9 @@
|
||||||
$this->auth_token);
|
$this->auth_token);
|
||||||
return $blob;
|
return $blob;
|
||||||
}
|
}
|
||||||
|
function reqToken($param1, $param2) {
|
||||||
|
return $this->api->hash($param1, $param2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SnaphaxApi {
|
class SnaphaxApi {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue