doudi7782 2014-10-23 12:55
浏览 173

上传到App Engine时出现CURLOPT_RETURNTRANSFER错误

When I upload my code to GAE I get the following error. I'm clueless on why I'm getting this.

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 

The code that I'm using:

<?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:
$authUrl

";
       print "Please enter the auth code:
";
       $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);
 ?>

I was able to retrieve the API keys and also enabled the Drive SDK and Drive API in the project.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题