Skip to content

Instantly share code, notes, and snippets.

@ikbear
Created September 18, 2014 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ikbear/2dfe89128c13a6636feb to your computer and use it in GitHub Desktop.
Save ikbear/2dfe89128c13a6636feb to your computer and use it in GitHub Desktop.
<?php
require_once("../../qiniu/http.php");
require_once("../../qiniu/auth_digest.php");
require_once("../../qiniu/utils.php");
$accessKey = "aW6EvpZBvWr5Qq3HiFCLiCmvkJORHN8oE-vKR8-z";
$secretKey = "8T270kMZuVZHRjLt6ACKdXj3VAAwPbmeOykQdmOA";
$bucket = "kouqiangzhongzhi";
$key = "CAD CAM种植导板的临床应用(1).mp4";
// $fops = "avthumb/flash/vb/2000k";
$fops = "avthumb/m3u8/preset/video_640k";
$notifyURL = "http://s52nxfcib7t9.runscope.net/";
$pipeline = "pekin";
$force = 0;
$encodedBucket = urlencode($bucket);
$encodedKey = urlencode($key);
$encodedFops = urlencode($fops);
$encodedNotifyURL = urlencode($notifyURL);
$encodedPipeline = urlencode($pipeline);
$apiHost = "http://api.qiniu.com";
$apiPath = "/pfop/";
$requestBody = "bucket=$encodedBucket&key=$encodedKey&fops=$encodedFops&notifyURL=$encodedNotifyURL&pipeline=$encodedPipeline";
// echo "Body 1: " . $requestBody . "\n";
// $requestBody = "bucket=helishi&key=math.mp4&fops=avthumb/m3u8/preset/video_640k/hlsKey/ZXhhbXBsZWtleTEyMzQ1Ng==/hlsKeyUrl/aHR0cDovL3p0ZXN0LnFpbml1ZG4uY29tL2NyeXB0MC5rZXk=&notifyURL=http://kaikeba-test.qiniudn.com&pipeline=ikbear";
echo "Body : " . $requestBody . "\n";
if ($force !== 0) {
$requestBody .= "&force=1";
}
$mac = new Qiniu_Mac($accessKey, $secretKey);
$client = new Qiniu_MacHttpClient($mac);
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
if ($err !== null) {
echo "failed\n";
var_dump($err);
} else {
echo "success\n";
var_dump($ret);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment