use Thrift\Protocol\TBinaryProtocol; // use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); // $auth_ret = $client->loginAuth('13989497004', 'aerohive', 1); // var_dump($auth_ret); // $token = $auth_ret->token; $token = "f7a7bcb9ce6221b41ef9f0526ff3a355"; echo $token, ' <br />'; $testfile = '46 String Quartet No. 2 in D Major_.m4a'; $ftype = 7; echo "===11===<br />"; // $alloc_ret = $client->allocobj($token, $ftype, $testfile) ; // var_dump($alloc_ret); // echo "====5555==<br />"; // $append_ret = $client->appendObj($token, $testfile, $bin , $ftype); // var_dump($append_ret); // $odescr = array('test1'=>'testa','test2'=>'testb');
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('13989497004', 'aerohive', 1); echo "===3====<br />"; var_dump($auth_ret); $token = $auth_ret->token; echo "===4===<br />"; // $token ="f7a7bcb9ce6221b41ef9f0526ff3a355"; $ftype = 1; $filename = '李克勤 - 月半小夜曲.mp3'; $list_ret = $client->queryFileList($token, $ftype, 0, 10); var_dump($list_ret); // exit(0); // $ret_del = $client->delObj($token, $filename, $ftype); // var_dump($ret_del); // echo "====4444==<br />";
} use Thrift\Protocol\TBinaryProtocol; use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('hzshark', 'aerohive', 1); var_dump($auth_ret); echo "<br />"; $token = "01b01749295bde67648c687b44ff408c"; $filename = "aa.txt"; $offer_star = 1024; $filepath = '/tmp/test.thrift'; header('cache-control:public'); header('content-type:application/octet-stream'); header('content-disposition:attachment; filename=' . $name); header('HTTP/1.1 206 Partial Content'); header('Accept-Ranges:bytes'); if (file_exists($filepath)) { $filename = basename($filepath);
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('13355786900', '123456', 1); echo "===3===<br />"; var_dump($auth_ret); $token = $auth_ret->token; echo "===4===<br />"; // $token = '76b15c2a89c9b22ec950fe2e2dab2ddf'; $ftype = 1; $testfile = 'test0001.log'; $bin = 'testtesttest'; echo "一开始用户已用容量:" . PHP_EOL; echo $auth_ret->uspace . PHP_EOL; $alloc_ret = $client->allocobj($token, $ftype, $testfile); var_dump($alloc_ret); echo "====5555==<br />";
$EXCEED_SESSION_LIMIT = 5; // 并发限制 $TRY_LATER = 6; $ERR_OCCURED = 7; // 未知异常错误 $FILE_EXIST = 8; // 文件已经存在 function print_log() { } try { $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('127.0.0.1', 8080, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $user = '******'; $password = '******'; $ftype = 6; $testfile = 'test002.jpg'; $filedata = 'test data'; $odescr = array('test1' => 'testa', 'test2' => 'testb'); $attribute = 'test1'; echo "test getver interface..."; echo "<br />"; $res_ver = $client->GetVer(); if ($res_ver->result->ret == $SUCCESS) { echo "getver is ok. "; echo "getver return value:"; echo 'url=>' . $res_ver->url;
use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } // $socket = new THttpClient('221.7.13.207', 8080, '/testchdserver.php'); // $socket = new THttpClient('localhost', 8080, '/testchdserver.php'); $socket = new THttpClient('10.155.30.170', 8888, '/testchdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $ftype = 1; $filename = 'GlobalProtect64.msi'; $starttime = time(); echo $starttime; echo "<br />"; $filepath = '/home/hshao/newoutput.xml'; // $filepath = 'C:/Users/Administrator/Downloads/GlobalProtect64.msi'; if (file_exists($filepath)) { $filesize = filesize($filepath); $offset = 0; $readlen = 10 * 1024; $sendsize = 1; $read_bin = file_get_contents($filepath, $use_include_path = null, $context = null, $offset, $readlen); while (true) {
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $mobile = 'hzshark'; $passwd = 'aerohive'; $auth_ret = $client->loginAuth($mobile, $passwd, 1); $token = $auth_ret->token; $attribute = 'test1'; echo "===3===<br />"; var_dump($auth_ret); $ret = $client->queryObjectMetadata($token, $attribute, $objid, $type); var_dump($ret); $transport->close(); } catch (TException $tx) { print 'TException: ' . $tx->getMessage() . "\n"; } ?>
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); // $auth_ret = $client->loginAuth('hzshark', 'aerohive', 1); // echo "===3===<br />"; // var_dump($auth_ret); // $token = $auth_ret->token; // echo "===4===<br />"; $token = "f7a7bcb9ce6221b41ef9f0526ff3a355"; $ftype = 6; $filename = 'netdiskportrait'; $queryobj_ret = $client->queryobj($token, $ftype, $filename); var_dump($queryobj_ret); // $list_ret = $client->queryFileList($token,$ftype, 0, 10); // var_dump($list_ret); $del_ret = $client->delObj($token, $filename, $ftype); var_dump($del_ret);
use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } //$socket = new THttpClient('localhost', 8080, '/chdserver.php'); $socket = new THttpClient('localhost', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('18600000000', '123456', 1); echo "===3====<br />"; // var_dump($auth_ret); $token = $auth_ret->token; echo "token=>" . $token . PHP_EOL; echo "===4===<br />"; // $token ="f7a7bcb9ce6221b41ef9f0526ff3a355"; $ftype = 1; $filename = 'apache-jmeter-2.13_src.zip'; $list_ret = $client->queryFileList($token, $ftype, 0, 10); var_dump($list_ret); // exit(0); $ret_del = $client->delObj($token, $filename, $ftype); var_dump($ret_del);
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8080, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('13355786900', '123456', 1); echo "===3====<br />"; var_dump($auth_ret); $token = $auth_ret->token; echo "===4===<br />"; // $token ="f7a7bcb9ce6221b41ef9f0526ff3a355"; $ftype = 8; $filename = '1455714744.ntp'; $ret_del = $client->delObj($token, $filename, $ftype); $filename = time() . '000.ntp'; $list_ret = $client->queryFileList($token, $ftype, 0, 10); var_dump($list_ret); exit(0); $ret_del = $client->delObj($token, $filename, $ftype);
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); echo "===22===<br />"; $auth_ret = $client->loginAuth('hzshark', 'aerohive', 1); echo "===3===<br />"; var_dump($auth_ret); $token = $auth_ret->token; echo "===4===<br />"; $pwd = '123456'; $umobile = '13989497004'; $captcha = '8644'; $rest_ret = $client->Resetpwd($token, $pwd, $umobile, $captcha); var_dump($rest_ret); echo "===22===<br />"; $auth_ret = $client->loginAuth('hzshark', $pwd, 1); echo "===3===<br />";
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $mobile = '13989497004'; $passwd = 'aerohive'; $cat = '2776'; $captcha = 'netdisk_delete'; $ret = $client->DeleteUser($mobile, $captcha); var_dump($ret); $uspace = $client->RegistUser($mobile, $passwd, $cat); var_dump($uspace); $auth_ret = $client->loginAuth($mobile, $passwd, 1); echo "===3===<br />"; var_dump($auth_ret); $transport->close(); } catch (TException $tx) { print 'TException: ' . $tx->getMessage() . "\n";
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\UserInfo; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); // $auth_ret = $client->loginAuth('hzshark', 'aerohive', 1); // echo "===3===<br />"; // var_dump($auth_ret); // $token = $auth_ret->token; $token = 'cc8f1685a1a616298587423bed0043cb'; echo "===4===<br />"; $ualias = $client->QueryAlias($token); var_dump($ualias); echo "===5===<br />"; $ret = $client->SetAlias($token, 'alias_test_2'); var_dump($ret); $ualias = $client->QueryAlias($token); var_dump($ualias); $ret_info = $client->QueryUserInfo($token);
} use Thrift\Protocol\TBinaryProtocol; use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); $auth_ret = $client->loginAuth('hzshark', 'aerohive', 1); var_dump($auth_ret); echo "<br />"; $token = "01b01749295bde67648c687b44ff408c"; $filename = "aa.txt"; $offerstar = 1024; $param['token'] = $token; $param['filename'] = $filename; $param['offerstar'] = $offerstar; $param['bin'] = 0; $uploadParam = new \proto\UploadParam($param); $upload_ret = $client->uploadFile($uploadParam); print "<br />********************<br />"; var_dump($upload_ret);
// token 验证错误 $EXCEED_SESSION_LIMIT = 5; // 并发限制 $TRY_LATER = 6; $ERR_OCCURED = 7; // 未知异常错误 $FILE_EXIST = 8; // 文件已经存在 function print_log() { } try { $socket = new THttpClient('127.0.0.1', 8080, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); // $user = '******'; $user = '******'; $password = '******'; $ftype = 6; $testfile = 'netdiskportrait'; // 145851101792 $filedata = file_get_contents('test10.jpg'); $odescr = array('test1' => 'testa', 'test2' => 'testb'); $attribute = 'test1'; echo "test loginAuth interface..."; echo "<br />"; $auth_ret = $client->loginAuth($user, $password, 1); if ($auth_ret->result->ret == $SUCCESS) { echo "loginAuth is ok. ";
// use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; use proto\DownloadParam; try { // if (array_search('--http', $argv)) { // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); // } else { // $socket = new TSocket('localhost', 9090); // } $socket = new THttpClient('221.7.13.207', 8080, '/chdserver.php'); // $socket = new THttpClient('localhost', 8888, '/chdserver.php'); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \proto\CloudHardDiskServiceClient($protocol); $transport->open(); echo $client->GetVer(); echo "===22===<br />"; $auth_ret = $client->loginAuth('netdisk', 'aerohive', 1); echo "===3===<br />"; var_dump($auth_ret); $token = $auth_ret->token; echo "===4===<br />"; $list_ret = $client->queryFileList($token, 1, 0, 10); var_dump($list_ret); echo "====22==<br />"; $q_ret = $client->QueryFile($token, 1, 'hello.txt'); var_dump($q_ret); echo "====333==<br />"; exit(0);