java-php request Seven Cow server get uploadtoken can't upload pictures on Android app

Source: Internet
Author: User
Tags autoload autoloader composer install
I use PHP to request seven cattle server to get Uploadtoken, the Uploadtoken to the JSON data output to the Android app upload images, using my own server to obtain the Uploadtoken can not upload pictures (http://nnddkj.com/ Laugh/seven ... ), I use an example of the official web site to generate Uploadtoken in the app can be used to upload pictures (http://jssdk.demo.qiniu.io/up ... ), I ask the gods, this is not the uploadtoken I get to the wrong ah, where I was mistaken? Here's how I use PHP to get Uploadtoken:
Require_once './autoload.php ';
Introduction of the Authentication class
Use Qiniuauth;
Introducing the Upload class
Use Qiniustorageuploadmanager;

$bucket = ' space name ';
$accessKey = ' ak ';
$secretKey = ' SK ';
$auth = new Auth ($accessKey, $secretKey);

$upToken = $auth->uploadtoken ($bucket);
$updateToken =array (' id ' =>1, ' updatetoken ' + $upToken);
echo Json_encode ($updateToken);
My server is using ubuntu14.0.1, PHP environment is used XAMPP integrated, php7.0, PHP site environment normal use. I downloaded the "PHP SDK download Address" This SDK, and then directly referenced the SDK autoload files, auth files, uploadmanager files, about the use of composer installation SDK This step is not familiar with, looked for several days, I executed this directive curl-ss Https://getcomposer.org/insta ... | PHP downloaded the software, and then according to composer official website to perform composer install installation completed, and the following two do not know how to use
2. Run the Composer command to install the latest stable version of the SDK:

php composer.phar require qiniu/php-sdk

3. Require Composer generated autoloader:


  
   

Reply content:

I use PHP to request seven cattle server to get Uploadtoken, the Uploadtoken to the JSON data output to the Android app upload images, using my own server to obtain the Uploadtoken can not upload pictures (http://nnddkj.com/ Laugh/seven ... ), I use an example of the official web site to generate Uploadtoken in the app can be used to upload pictures (http://jssdk.demo.qiniu.io/up ... ), I ask the gods, this is not the uploadtoken I get to the wrong ah, where I was mistaken? Here's how I use PHP to get Uploadtoken:
Require_once './autoload.php ';
Introduction of the Authentication class
Use Qiniuauth;
Introducing the Upload class
Use Qiniustorageuploadmanager;

$bucket = ' space name ';
$accessKey = ' ak ';
$secretKey = ' SK ';
$auth = new Auth ($accessKey, $secretKey);

$upToken = $auth->uploadtoken ($bucket);
$updateToken =array (' id ' =>1, ' updatetoken ' + $upToken);
echo Json_encode ($updateToken);
My server is using ubuntu14.0.1, PHP environment is used XAMPP integrated, php7.0, PHP site environment normal use. I downloaded the "PHP SDK download Address" This SDK, and then directly referenced the SDK autoload files, auth files, uploadmanager files, about the use of composer installation SDK This step is not familiar with, looked for several days, I executed this directive curl-ss Https://getcomposer.org/insta ... | PHP downloaded the software, and then according to composer official website to perform composer install installation completed, and the following two do not know how to use
2. Run the Composer command to install the latest stable version of the SDK:

php composer.phar require qiniu/php-sdk

3. Require Composer generated autoloader:


  
    
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.