X
ID저장

문자싸다

API 호출 예제 코드

각 언어별 예제입니다. HostAPI Key 정보를 실제 환경에 맞게 수정하여 적용하세요.

PHP (cURL)

POST https://munjassada.com/api/send.php HTTP/1.1
Host: munjassada.com
Content-Type: application/x-www-form-urlencoded
// --------------------------------------------------
$url = "https://munjassada.com/api/send.php";
$identifier = "YOUR_API_ID";
$secret_key = "YOUR_API_KEY";
$timestamp = time();
$nonce = uniqid("nonce_", true);
$data = [
  "identifier" => $identifier,
  "sender"     => "01012345678",
  "receiver"   => "01000000000",
  "msg"        => "테스트 메시지",
  "timestamp" => $timestamp,
  "nonce"     => $nonce
];
ksort($data);
$base = http_build_query($data);
$signature = hash_hmac("sha256", $base, $secret_key);
$data["signature"] = $signature;
// cURL 실행 생략...

JSP (HttpURLConnection)

// HMAC 서명 포함
String url = "https://munjassada.com/api/send.php";
String identifier = "YOUR_API_ID";
String secretKey = "YOUR_API_KEY";
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
String nonce = "nonce_" + System.currentTimeMillis();
Map<String, String> params = new TreeMap<>();
params.put("identifier", identifier);
params.put("sender", "01012345678");
params.put("receiver", "01000000000");
params.put("msg", "테스트 메시지");
params.put("timestamp", timestamp);
params.put("nonce", nonce);
StringBuilder base = new StringBuilder();
for (Map.Entry<String,String> e : params.entrySet()) {
  if (base.length() > 0) base.append("&");
  base.append(e.getKey()).append("=").append(e.getValue());
}
String signature = hmacSha256(base.toString(), secretKey);
params.put("signature", signature);
// HttpURLConnection POST 실행 생략...

Node.js (Axios)

POST /api/send.php HTTP/1.1
Host: munjassada.com
// --------------------------------------------------
const axios = require("axios");
const crypto = require("crypto");
const identifier = "YOUR_API_ID";
const secretKey = "YOUR_API_KEY";
const timestamp = Math.floor(Date.now()/1000);
const nonce = "nonce_" + Date.now();
const data = { identifier, sender: "01012345678", receiver: "01000000000", msg: "테스트 메시지", timestamp, nonce };
const base = Object.keys(data).sort().map(k => `${k}=${data[k]}`).join("&");
data.signature = crypto.createHmac("sha256", secretKey).update(base).digest("hex");
axios.post("https://munjassada.com/api/send.php", new URLSearchParams(data))
.then(res => console.log(res.data));

Python (Requests)

POST /api/send.php HTTP/1.1
Service Port: 443
# --------------------------------------------------
import requests, time, hmac, hashlib
url = "https://munjassada.com/api/send.php"
identifier = "YOUR_API_ID"
secret_key = "YOUR_API_KEY"
timestamp = int(time.time())
nonce = f"nonce_{timestamp}"
data = {
  "identifier": identifier,
  "sender": "01012345678",
  "receiver": "01000000000",
  "msg": "테스트 메시지",
  "timestamp": timestamp,
  "nonce": nonce
}
base = "&".join([f"{k}={data[k]}" for k in sorted(data.keys())])
signature = hmac.new(secret_key.encode(), base.encode(), hashlib.sha256).hexdigest()
data["signature"] = signature
res = requests.post(url, data=data)
print(res.text)

고객센터

  • 02.2648.0501
  • 평일 : 09시 ~ 18시

    점심 : 12시 ~ 13시 주말,공휴일 휴무

    공지사항

    • 게시물이 없습니다.
  • 회사소개
  • 서비스이용약관
  • 개인정보취급방침
  • 광고/스팸문자 정책
  • 이메일무단수집거부
  • 고객센터