The code is as follows: {code ...} returned value: {code ...} the following code appears during access: {& quot; error & quot;: & quot; badoauthrequest & quot:
Foreach ($ filenames as $ k => $ v) {if ($ v! = "." & $ V! = "...") {// Enter your Access Key and Secret Key $ accessKey = ''; $ secretKey =''; $ domain =" http://o8ouat0ny.qnssl.com/ "; // Construct the authentication object $ auth = new \ Qiniu \ Auth ($ accessKey, $ secretKey); // the space to be uploaded $ bucket = 'phone-recording '; // Generate the upload Token $ token = $ auth-> uploadToken ($ bucket); // The local path of the file to be uploaded $ filePath = public_path (). '/phone-records /'. $ v; // name of the file saved after the upload to Qiniu $ key = $ v; // initialize the UploadManager object and upload the file $ uploadMgr = new UploadManager (); // download credential validity period // $ duetime = 31536000; // call the putFile method of UploadManager to upload the file list ($ ret, $ er R) = $ uploadMgr-> putFile ($ token, $ key, $ filePath); if (is_null ($ err) {// var_dump ($ domain. $ ret ['key']. '? E = '. $ duetime.' & token = '. $ token); return $ domain. $ ret ['key'].'? Token = '. $ token;} else {var_dump ($ err );}}}
Return value:
http://o8ouat0ny.qnssl.com/xiaoyin04.mp3?token=0aWD7M62qvq1ehkx53Kx1yOR8qtawHOkg9lsp90W:wibT2Kc5KHlhc90KYDk4oXCXyPs=:eyJzY29wZSI6InBob25lLXJlY29yZGluZyIsImRlYWRsaW5lIjoxNDY1ODIxMTU5fQ==
The following error occurs during access:{"error":"bad oauth request"}
Reply content:
The code is as follows:
Foreach ($ filenames as $ k => $ v) {if ($ v! = "." & $ V! = "...") {// Enter your Access Key and Secret Key $ accessKey = ''; $ secretKey =''; $ domain =" http://o8ouat0ny.qnssl.com/ "; // Construct the authentication object $ auth = new \ Qiniu \ Auth ($ accessKey, $ secretKey); // the space to be uploaded $ bucket = 'phone-recording '; // Generate the upload Token $ token = $ auth-> uploadToken ($ bucket); // The local path of the file to be uploaded $ filePath = public_path (). '/phone-records /'. $ v; // name of the file saved after the upload to Qiniu $ key = $ v; // initialize the UploadManager object and upload the file $ uploadMgr = new UploadManager (); // download credential validity period // $ duetime = 31536000; // call the putFile method of UploadManager to upload the file list ($ ret, $ er R) = $ uploadMgr-> putFile ($ token, $ key, $ filePath); if (is_null ($ err) {// var_dump ($ domain. $ ret ['key']. '? E = '. $ duetime.' & token = '. $ token); return $ domain. $ ret ['key'].'? Token = '. $ token;} else {var_dump ($ err );}}}
Return value:
http://o8ouat0ny.qnssl.com/xiaoyin04.mp3?token=0aWD7M62qvq1ehkx53Kx1yOR8qtawHOkg9lsp90W:wibT2Kc5KHlhc90KYDk4oXCXyPs=:eyJzY29wZSI6InBob25lLXJlY29yZGluZyIsImRlYWRsaW5lIjoxNDY1ODIxMTU5fQ==
The following error occurs during access:{"error":"bad oauth request"}
Your download credential is incorrect.
Document: http://developer.qiniu.com/article/developer/security/download-token.html
Php demo: http://developer.qiniu.com/code/v7/sdk/php.html#download