uploader script (example)
This commit is contained in:
parent
d50ac7b0de
commit
1e5a7140b3
1 changed files with 28 additions and 0 deletions
28
examples/upload.php
Normal file
28
examples/upload.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?
|
||||
// upload snaps from the command line
|
||||
|
||||
require('../snaphax.php');
|
||||
|
||||
function main() {
|
||||
global $argv;
|
||||
|
||||
if (count($argv) != 5) {
|
||||
die("$argv[0]: usage $argv[0] [user] [pass] [fname] [recipients]\n");
|
||||
}
|
||||
|
||||
$fdata = file_get_contents($argv[3]);
|
||||
if (!$fdata) die("could not read $argv[3]");
|
||||
|
||||
$opts = array();
|
||||
$opts['username'] = $argv[1];
|
||||
$opts['password'] = $argv[2];
|
||||
$opts['debug'] = 1;
|
||||
|
||||
$s = new Snaphax($opts);
|
||||
$result = $s->login();
|
||||
var_dump($result);
|
||||
$result = $s->upload($fdata, SnapHax::MEDIA_IMAGE, array($argv[4]));
|
||||
var_dump($result);
|
||||
}
|
||||
|
||||
main();
|
Loading…
Add table
Add a link
Reference in a new issue