Baidu Open Cloud phpsdk download Address: http://developer.baidu.com/wiki/index.php?title=%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3%E9%A6%96% E9%a1%b5/web%e5%ba%94%e7%94%a8%e6%8e%a5%e5%85%a5/sdk
Instance code:
Copy CodeThe code is as follows:
/**
* AUTHOR:HANKCS
* date:14-3-29
* Time: 10:29
*/
Ini_set ("Max_execution_time", 36000);
Require_once '. /bcs.class.php ';
Require_once '. /krumo/class.krumo.php ';
$host = ' bcs.duapp.com ';
$ak = ' Your public key ';
$sk = ' your private key ';
$bucket = ' bucket name to download ';
$baidu _bcs = new Baidubcs ($ak, $sk, $host);
$response = Json_decode ($baidu _bcs->list_object ($bucket, Array (' start ' = 0, ' limit ' = ' 1024x768 '),->body);
$downloaded _size = 0;
while ($downloaded _size < $response->object_total)
{
Krumo ($response);
Download them
foreach ($response->object_list as $object)
{
if (! $object->is_dir)
{
Mk_dir ('. '). $object->parent_dir);
$result = $baidu _bcs->get_object ($bucket, $object->object, Array ("Filewriteto" = "."). $object->object));
}
}
$downloaded _size + = count ($response->object_list);
$response = Json_decode ($baidu _bcs->list_object ($bucket, Array (' Start ' = $downloaded _size, ' limit ' = 1024,) )->body);
}
function Mk_dir ($dir, $mode = 0755)
{
if (Is_dir ($dir) | | @mkdir ($DIR, $mode)) return true;
if (!mk_dir (DirName ($dir), $mode)) return false;
Return @mkdir ($dir, $mode);
}
http://www.bkjia.com/PHPjc/751936.html www.bkjia.com true http://www.bkjia.com/PHPjc/751936.html techarticle Baidu Open Cloud phpsdk download Address: http://developer.baidu.com/wiki/index.php?title=%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3%E9%A6 %96%E9%A1%B5/WEB%E5%BA%94%E7%94%A8%E6%8E%A5%E5%85%A5/S ...