<?php
// PHP示例代码
$apiKey = 'YOUR_API_KEY';
$apiUrl = 'https://jiami.zhuidc.com/api.php';
// 1. 上传文件
$postData = [
'api_key' => $apiKey,
'encryption_type' => 'IC',
'edition' => 'IC12',
'file' => new CURLFile('/path/to/your/file.zip')
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $apiUrl . '?action=upload',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$uploadResult = json_decode($response, true);
if ($uploadResult['success']) {
$space = $uploadResult['data']['space'];
// 2. 提交加密参数
$submitData = [
'api_key' => $apiKey,
'space' => $space,
'version' => '7.4',
'comment' => 'API测试文件',
'allowed' => '192.168.1.1'
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $apiUrl . '?action=submit',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $submitData,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$submitResult = json_decode($response, true);
if ($submitResult['success']) {
// 3. 下载文件
$downloadUrl = $apiUrl . '?action=download&api_key=' . urlencode($apiKey) . '&space=' . urlencode($space);
file_put_contents('encrypted_file.zip', file_get_contents($downloadUrl));
echo "文件加密下载完成!";
}
}
?>
import requests
api_key = 'YOUR_API_KEY'
api_url = 'https://jiami.zhuidc.com/api.php'
# 1. 上传文件
files = {
'file': open('/path/to/your/file.zip', 'rb')
}
data = {
'api_key': api_key,
'encryption_type': 'IC',
'edition': 'IC12'
}
response = requests.post(api_url + '?action=upload', files=files, data=data)
upload_result = response.json()
if upload_result['success']:
space = upload_result['data']['space']
# 2. 提交加密参数
submit_data = {
'api_key': api_key,
'space': space,
'version': '7.4',
'comment': 'API测试文件',
'allowed': '192.168.1.1'
}
response = requests.post(api_url + '?action=submit', data=submit_data)
submit_result = response.json()
if submit_result['success']:
# 3. 下载文件
download_url = api_url + '?action=download&api_key=' + api_key + '&space=' + space
response = requests.get(download_url)
with open('encrypted_file.zip', 'wb') as f:
f.write(response.content)
print("文件加密下载完成!")
# 1. 上传文件
curl -X POST \
"https://jiami.zhuidc.com/api.php?action=upload" \
-F "api_key=YOUR_API_KEY" \
-F "encryption_type=IC" \
-F "edition=IC12" \
-F "file=@/path/to/your/file.zip"
# 2. 提交加密参数
curl -X POST \
"https://jiami.zhuidc.com/api.php?action=submit" \
-d "api_key=YOUR_API_KEY" \
-d "space=SPACE_FROM_UPLOAD" \
-d "version=7.4" \
-d "comment=API测试文件"
# 3. 下载文件
curl -X GET \
"https://jiami.zhuidc.com/api.php?action=download&api_key=YOUR_API_KEY&space=SPACE_FROM_UPLOAD" \
-o encrypted_file.zip