上传到App Engine时出现CURLOPT_RETURNTRANSFER错误

时间:2014-10-23 12:55:46

标签: php google-app-engine google-drive-api

当我将代码上传到GAE时,我收到以下错误。我对为什么得到这个我一无所知。

Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed    

'CURLOPT_RETURNTRANSFER' in /base/data/home/apps/s~yourwebpay/1.379586028882033552/google-api-php-
 client/src/Google_Client.php on line 106 Notice: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' in /base/data/home/apps/s~yourwebpay/1.379586028882033552/google-api-php-client/src/Google_Client.php on line 106 Notice: Use of undefined constant CURLOPT_FAILONERROR - assumed 'CURLOPT_FAILONERROR' in 

我正在使用的代码:

<?php
   require_once 'google-api-php-client/src/Google_Client.php';
   require_once 'google-api-php-client/src/contrib/Google_DriveService.php';

    $client = new Google_Client();
    // Get your credentials from the console
       $client->setClientId('YOUR_CLIENT_ID');
       $client->setClientSecret('YOUR_CLIENT_SECRET');
       $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
       $client->setScopes(array('https://www.googleapis.com/auth/drive'));

       $service = new Google_DriveService($client);

       $authUrl = $client->createAuthUrl();

       //Request authorization
       print "Please visit:\n$authUrl\n\n";
       print "Please enter the auth code:\n";
       $authCode = trim(fgets(STDIN));

       // Exchange authorization code for access token
       $accessToken = $client->authenticate($authCode);
        $client->setAccessToken($accessToken);

        //Insert a file
        $file = new Google_DriveFile();
       $file->setTitle('My document');
      $file->setDescription('A test document');
     $file->setMimeType('text/plain');

      $data = file_get_contents('document.txt');

   $createdFile = $service->files->insert($file, array(
  'data' => $data,
  'mimeType' => 'text/plain',
));

 print_r($createdFile);
 ?>

我能够检索API密钥并在项目中启用了Drive SDK和Drive API。

0 个答案:

没有答案
相关问题