Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class d_naccl_top implements api
|
||||
{
|
||||
|
||||
public function create($url)
|
||||
{
|
||||
$post = ['longURL' => $url];
|
||||
$data = get_curl('https://d.naccl.top/generate', http_build_query($post));
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->data) && $json->code === 200) {
|
||||
return $json->data;
|
||||
}
|
||||
if (!empty($json->msg)) {
|
||||
throw new \Exception($json->msg);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class dwz_tax implements api
|
||||
{
|
||||
|
||||
public function create($url)
|
||||
{
|
||||
$post = [
|
||||
'token' => 'k9ah7rn36d1dsu51jpjeboopg4',
|
||||
'longurl' => $url,
|
||||
'alias' => '',
|
||||
'expiry' => '',
|
||||
'password' => '',
|
||||
];
|
||||
$data = get_curl('https://dwz.tax/api/shorten', http_build_query($post), 'https://dwz.tax/');
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->short)) {
|
||||
return $json->short;
|
||||
}
|
||||
if (!empty($json->msg)) {
|
||||
throw new \Exception($json->msg);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class gg_gg implements api
|
||||
{
|
||||
|
||||
public function create($url)
|
||||
{
|
||||
$post = [
|
||||
'custom_path' => '',
|
||||
'use_norefs' => '0',
|
||||
'long_url' => $url,
|
||||
'app' => 'site',
|
||||
'version' => '0.1',
|
||||
];
|
||||
$data = get_curl('http://gg.gg/create', http_build_query($post), 'http://gg.gg/');
|
||||
if (!empty($data)) {
|
||||
return $data;
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class is_gd implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$data = get_curl("https://is.gd/create.php?format=json&url=".urlencode($url));
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->shorturl)) {
|
||||
return $json->shorturl;
|
||||
}
|
||||
if (!empty($json->errormessage)) {
|
||||
throw new \Exception($json->errormessage);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class lnks_tools implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$data = get_curl('https://lnks.tools', json_encode([
|
||||
'url' => $url,
|
||||
]));
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->key)) {
|
||||
return 'https://lnks.tools' . $json->key;
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class moelink_org implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$post = [
|
||||
'url' => $url,
|
||||
];
|
||||
$data = get_curl('https://moelink.org/shorten', http_build_query($post));
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->data->shorturl) && $json->error === false) {
|
||||
return $json->data->shorturl;
|
||||
}
|
||||
if (!empty($json->message)) {
|
||||
throw new \Exception($json->message);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class p_sogou_com implements api
|
||||
{
|
||||
|
||||
public function create($url)
|
||||
{
|
||||
if(substr(parse_url($url)['host'], -9) != 'sogou.com')
|
||||
$url = 'https://m.sogou.com/web/confirm.jsp?url='.urlencode($url);
|
||||
$data = get_curl('http://sa.sogou.com/gettiny?url='.urlencode($url).'&mid=ff92866333010593695&xid=87b53ac05cc35e678d172752bd690bc3dcb7&imsi=460072887441781&ts=1501395961638&crypto=9agMSumkNV29lKu3jelybeLPZ+c4yDU2Vu7YaMj1OucASKqPnn+Pdo/cQMXTLY3+&ver=5.2.1.0');
|
||||
if (!empty($data)) {
|
||||
return $data;
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class suo_yt implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$post = [
|
||||
'longUrl' => base64_encode($url),
|
||||
];
|
||||
$data = get_curl('https://suo.yt/short', http_build_query($post));
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->ShortUrl)) {
|
||||
return $json->ShortUrl;
|
||||
}
|
||||
if (!empty($json->Message)) {
|
||||
throw new \Exception($json->Message);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class tinyurl_com implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$post = [
|
||||
'url' => $url,
|
||||
'format' => 'json',
|
||||
];
|
||||
$get = get_curl('https://tinyurl.com/api-create.php', http_build_query($post));
|
||||
if (is_valid_url($get)) {
|
||||
return $get;
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\utility\short_url\api;
|
||||
|
||||
use plugin\utility\short_url\api;
|
||||
|
||||
class zm_cx implements api
|
||||
{
|
||||
|
||||
public function create($url): string
|
||||
{
|
||||
$post = json_encode([
|
||||
'url' => $url,
|
||||
]);
|
||||
$data = get_curl('https://zm.cx/api/set.php', $post);
|
||||
$json = json_decode($data);
|
||||
if (!empty($json) && !empty($json->content->url)) {
|
||||
return $json->content->url;
|
||||
}
|
||||
if (!empty($json->content)) {
|
||||
throw new \Exception($json->content);
|
||||
}
|
||||
throw new \Exception('生成失败');
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user