我正在尝试使用谷歌驱动器api创建文件夹.我能够在最后得到文件ID.但我无法在谷歌驱动器中的文件夹.看来有些许可问题?
$scopes = array(
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.appdata','https://www.googleapis.com/auth/drive.apps.readonly',
'https://www.googleapis.com/auth/drive.metadata','https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/drive.readonly','https://www.googleapis.com/auth/drive.photos.readonly'
);
$creds = new Google_Auth_AssertionCredentials(
$serviceAccountName,
$scopes,
file_get_contents($keyFile)
);
$client = new Google_Client();
$client->setApplicationName($appName);
$client->setClientId($clientId);
$client->setAssertionCredentials($creds);
$service = new Google_Service_Drive($client);
$fileMetadata = new Google_Service_Drive_DriveFile(array(
'name' => 'Invoices',
'permissions' => array('type'=>'anyone','role'=>'reader','allowFileDiscovery'=>1),
'mimeType' => 'application/vnd.google-apps.folder'));
$file = $service->files->create($fileMetadata, array());
printf("File ID: %s\n", $file->id);
Run Code Online (Sandbox Code Playgroud) 我正在使用nodejs将文件上传到aws服务器.并发现文件大小不正确.我得到2.1KB.
这是我的代码
var uploadFile = function (fileReadStream, awsHeader, cb) {
//set options for the streaming module
var options = {
concurrentParts: 2,
waitTime: 20000,
retries: 2,
maxPartSize: 10 * 1024 * 1024
};
//call stream function to upload the file to s3
var uploader = new streamingS3(fileReadStream, config.aws.accessKey, config.aws.secretKey, awsHeader, options);
//start uploading
uploader.begin();// important if callback not provided.
// handle these functions
uploader.on('data', function (bytesRead) {
//console.log(bytesRead, ' bytes read.');
});
uploader.on('part', function (number) {
//console.log('Part ', number, ' …Run Code Online (Sandbox Code Playgroud) 我在Ubuntu中使用nodejs.我想要禁用SSL 3.0和TLS v1.0.
这是我的代码
var constants = require('constants')
, https = require('https')
, path = require('path')
, tls = require('tls')
, fs = require('fs');
var sslOptions = {
key: fs.readFileSync('/etc/ssl/private/private.key'),
secureProtocol: 'SSLv23_server_method',
secureOptions: constants.SSL_OP_NO_SSLv3,
secureOptions: constants.SSL_OP_NO_TLSv1,
cert: fs.readFileSync('/etc/ssl/certs/STAR_mycert.crt'),
ca: [
fs.readFileSync('/etc/ssl/certs/AddTrustExternalCARoot_1.crt'),
fs.readFileSync('/etc/ssl/certs/AddTrustExternalCARoot_2.crt'),
fs.readFileSync('/etc/ssl/certs/AddTrustExternalCARoot_3.crt')
],
//ca: fs.readFileSync('/etc/ssl/certs/AddTrustExternalCARoot.crt'),
requestCert: false,
rejectUnauthorized: false
};
Run Code Online (Sandbox Code Playgroud)
现在,当我在digicert上测试我的网站时,我遇到了以下问题
知道如何做到这一点?
我想获取一个网站的meta标签.这是我的代码
$tags = get_meta_tags('https://www.wired.com/story/avengers-infinity-war-d23-footage');
print_r($tags); exit;
Run Code Online (Sandbox Code Playgroud)
这返回空.任何的想法?
Wesbite正在使用像gzip这样的压缩.