ShortUrlGroupDemo


代码示列


获取短网址群组(get请求)

<?php

$url = "https://service.mysubmail.com/shorturl/group";
$appid = "";
$appkey = "";

//GET


$post_data['appid'] = $appid;
$post_data['signature'] = $appkey;
$post_data['group'] = "f36cb0d3685490e69676d1672b55a0f1";


$api = $url."?".http_build_query($post_data);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 0);

$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
print_r($output);



创建短链接群组(post请求)

<?php

$url = "https://service.mysubmail.com/shorturl/group";
$appid = "";
$appkey = "";


//POST

$post_data['appid'] = $appid;
$post_data['signature'] = $appkey;
$post_data['name'] = "test";



$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
print_r($output);



更新短链接群组(put请求)

<?php

$url = "https://service.mysubmail.com/shorturl/group";
$appid = "";
$appkey = "";

$post_data['appid'] = $appid;
$post_data['signature'] = $appkey;
$post_data['group'] = "bee78424d3adb0d096a13fde02c5b53f";
$post_data['name'] = "test again";


//PUT


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded"));

$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
print_r($output);



删除短链接群组(delete请求)

<?php

$url = "https://service.mysubmail.com/shorturl/group";
$appid = "";
$appkey = "";


//DELETE
$post_data['appid'] = $appid;
$post_data['signature'] = $appkey;
$post_data['group'] = "bee78424d3adb0d096a13fde02c5b53f";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded"));

$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
print_r($output);