马春杰短网址生成
  • 关于我们
  • 使用许可
  • 联系我们
  • 快捷缩短
  • Api
  • 统计

收藏夹快捷功能

马春杰短网址生成 书签帮助您快速生成短网址而不离开您的网站。

如果已记住密钥,会自动填充

✓ 书签已生成!

将下面的链接拖动到浏览器书签栏:

📌 马春杰短网址生成 - 缩短当前网址

提示:此书签已包含您的API密钥,可以直接使用

使用方法:
  1. 在输入框中输入您的API密钥
  2. 点击"生成书签"按钮
  3. 将显示的书签链接拖动到浏览器书签栏
  4. 在任何网页上点击这个书签即可创建短链接
马春杰短网址生成 Logo

Api 开发工具

你可以使用我们的API服务创建短网址

注意:使用API创建链接需要提供 API Key 进行身份验证。

获取 API Key

请登录管理后台,在「设置」页面中生成你的 API Key。每个用户的 API Key 都是唯一的,请妥善保管,不要泄露给他人。


基础 URL(需要认证)
输入 https://short.machunjie.com/api.php?url=XXX&key=YOUR_API_KEY
XXX 是你的 目标网址,请输入一个有效的网址,使用 http:// 或 https:// 开头
YOUR_API_KEY 是你的 API Key,用于身份验证
输出 https://short.machunjie.com/{alias}

自定义链接(需要认证)
输入 https://short.machunjie.com/api.php?url=XXX&cust=YYY&key=YOUR_API_KEY
XXX 是你的 目标网址,请输入一个有效的网址,使用 http:// 或 https:// 开头
YYY 是你的 自定义链接,只能是字母数字(允许使用下划线和破折号)
YOUR_API_KEY 是你的 API Key,用于身份验证
输出 https://short.machunjie.com/YYY

使用带密码的链接(需要认证)
输入 https://short.machunjie.com/api.php?url=XXX&pass=ZZZ&key=YOUR_API_KEY
XXX 是你的 目标网址,请输入一个有效的网址,使用 http:// 或 https:// 开头
ZZZ 是你的 访问密码,只能是字母数字(允许使用下划线和破折号)
YOUR_API_KEY 是你的 API Key,用于身份验证
输出 https://short.machunjie.com/{alias}

使用自定义链接和密码(需要认证)
输入 https://short.machunjie.com/api.php?url=XXX&cust=YYY&pass=ZZZ&key=YOUR_API_KEY
XXX 是你的 目标网址,请输入一个有效的网址,使用 http:// 或 https:// 开头
YYY 是你的 自定义链接,只能是字母数字(允许使用下划线和破折号)
ZZZ 是你的 访问密码,只能是字母数字(允许使用下划线和破折号)
YOUR_API_KEY 是你的 API Key,用于身份验证
输出 https://short.machunjie.com/YYY

使用示例

cURL(Linux/Mac/Windows):

curl -X POST "https://short.machunjie.com/api.php" \
  -d "url=https://example.com&key=YOUR_API_KEY"

PHP:

<?php
$api_url = 'https://short.machunjie.com/api.php';
$params = [
    'url' => 'https://example.com',
    'key' => 'YOUR_API_KEY'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);

echo $result;
?>

JavaScript(Fetch API):

fetch('https://short.machunjie.com/api.php', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: 'url=https://example.com&key=YOUR_API_KEY'
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

响应格式

成功响应:

https://short.machunjie.com/your-alias

错误响应:

Error: 无效的 API Key
Error: URL 参数不能为空
Error: 无效的 URL 格式
Error: 自定义链接已被使用

安全提示:请妥善保管你的 API Key,不要将其提交到公开的代码仓库或前端代码中。如果你的 Key 泄露,请及时在管理后台生成新的 Key。