已复制到剪贴板
v7.8
站点公告
本站可通过API进行对接,快速接入您的程序,如果有和本站一样的彩虹系统,可直接进行系统对接,对接进行余额扣款。如果还没账号的话,请先到 matenb.cn 注册账号,并确保提交的时候有充足的余额可扣款。不懂的可联系微信客服 kk14405132点击复制,来意请备注。此API专门为程序员打造的一款快速对接工具。
下单接口
请求地址(GET)
http://api.matenb.cn/api.php?tid=商品ID&user=账号&pass=密码&input1=参数&num=份数
参数说明
tid
必填
商品ID,如 38 / 33
user
必填
平台登录账号
pass
必填
平台登录密码
input1
必填
下单参数,目标链接/ID
num
必填
下单份数,正整数
代码示例
PHP
Python
Java
C++
C语言
JavaScript
HTML
易语言
// 下单示例 - cURL 方式(推荐)
$url = "http://api.matenb.cn/api.php?tid=38&user=xxx&pass=xxx&input1=xxx&num=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$res = curl_exec($ch);
curl_close($ch);
echo $res;
# 下单示例 - requests 库
import requests

url = "http://api.matenb.cn/api.php"
params = {
    "tid": 38,
    "user": "xxx",
    "pass": "xxx",
    "input1": "xxx",
    "num": 1
}
res = requests.get(url, params=params, timeout=10)
print(res.text)
// 下单示例 - HttpURLConnection 方式
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class OrderDemo {
    public static void main(String[] args) throws Exception {
        String urlStr = "http://api.matenb.cn/api.php?tid=38&user=xxx&pass=xxx&input1=xxx&num=1";
        URL url = new URL(urlStr);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setConnectTimeout(10000);
        
        BufferedReader br = new BufferedReader(
            new InputStreamReader(conn.getInputStream()));
        String line;
        StringBuilder sb = new StringBuilder();
        while ((line = br.readLine()) != null) {
            sb.append(line);
        }
        br.close();
        System.out.println(sb.toString());
    }
}
// 下单示例 - libcurl 方式
#include <iostream>
#include <curl/curl.h>
#include <string>

static size_t WriteCallback(void* contents, size_t size,
    size_t nmemb, std::string* s) {
    size_t newLength = size * nmemb;
    try {
        s->append((char*)contents, newLength);
    } catch(std::bad_alloc &e) {
        return 0;
    }
    return newLength;
}

int main() {
    CURL* curl = curl_easy_init();
    std::string response;
    if(curl) {
        const char* url =
            "http://api.matenb.cn/api.php?tid=38&user=xxx&pass=xxx&input1=xxx&num=1";
        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
        CURLcode res = curl_easy_perform(curl);
        if(res != CURLE_OK)
            std::cerr << "Error: " << curl_easy_strerror(res) << std::endl;
        else
            std::cout << response << std::endl;
        curl_easy_cleanup(curl);
    }
    return 0;
}
// 编译:g++ order.cpp -o order -lcurl
// 下单示例 - libcurl 方式
#include <stdio.h>
#include <curl/curl.h>

int main(void) {
    CURL *curl = curl_easy_init();
    if (curl) {
        const char *url =
            "http://api.matenb.cn/api.php?tid=38&user=xxx&pass=xxx&input1=xxx&num=1";
        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
        CURLcode res = curl_easy_perform(curl);
        if (res != CURLE_OK)
            fprintf(stderr, "Error: %s\n",
                curl_easy_strerror(res));
        curl_easy_cleanup(curl);
    }
    return 0;
}
// 编译:gcc order.c -o order -lcurl
// 下单示例 - fetch 方式(浏览器/Node.js)
const url = "http://api.matenb.cn/api.php";
const params = new URLSearchParams({
    tid: "38",
    user: "xxx",
    pass: "xxx",
    input1: "xxx",
    num: "1"
});

async function placeOrder() {
    try {
        const res = await fetch(`${url}?${params}`);
        const data = await res.text();
        console.log(data);
    } catch (err) {
        console.error(err);
    }
}
placeOrder();
<!-- 下单示例 - 纯HTML表单提交 -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>下单测试</title>
</head>
<body>
    <form action="http://api.matenb.cn/api.php" method="get">
        商品ID: <input type="text" name="tid" value="38"><br>
        账号: <input type="text" name="user"><br>
        密码: <input type="password" name="pass"><br>
        参数: <input type="text" name="input1"><br>
        份数: <input type="number" name="num" value="1"><br>
        <button type="submit">提交下单</button>
    </form>
</body>
</html>
' 下单示例 - 易语言 HTTP 方式
.版本 2
.支持库 spec
.支持库 internet

.子程序 _按钮1_被单击
.局部变量 url, 文本型
.局部变量 返回结果, 文本型

url = "http://api.matenb.cn/api.php?tid=38&user=xxx&pass=xxx&input1=xxx&num=1"
返回结果 = HTTP读文本 (url, , , , , )

调试输出 (返回结果)
信息框 (返回结果, 0, , )

' 方式二:使用 精易模块
.局部变量 网页_访问, 文本型
网页_访问 = 网页_访问S (url, 0, , , , , , , , , , , , , , )
调试输出 (网页_访问)
注意事项