Home Live Demo Endpoints Cron Job Code Mẫu

VN LOTTERY API

Giải pháp dữ liệu Xổ Số Kiến Thiết toàn diện 3 Miền

Nhanh chóng - Chuẩn JSON - Miễn Phí

Tích Hợp Ngay

Kết Quả Xổ Số Trực Tiếp

Hiển thị kết quả xổ số 3 miền siêu tốc, chính xác với hiệu ứng nhảy số trực tiếp.
LIVE Tự động cập nhật

Mã Nhúng Widget

Dán đoạn mã sau vào trang web của bạn để hiển thị kết quả tương tự.


                        
                    

                        
                    

Widget tự động cập nhật kết quả live mỗi phút và hỗ trợ xem loto chi tiết.

Danh Sách Endpoint

Base URL: https://xoso-api.webviet.vn/

Method Dịch Vụ Endpoint (URL Đầy Đủ) Mô Tả
GET Miền Nam https://xoso-api.webviet.vn/api.php?region=mn Lấy KQXS MN mới nhất (CACHE 60s)
GET Miền Trung https://xoso-api.webviet.vn/api.php?region=mt Lấy KQXS MT mới nhất (CACHE 60s)
GET Miền Bắc https://xoso-api.webviet.vn/api.php?region=mb Lấy KQXS MB mới nhất (CACHE 60s)
GET Lịch Sử https://xoso-api.webviet.vn/api.php?date=dd-mm-yyyy Lấy KQXS theo ngày (VD: 10-01-2026)
GET LIVE MN https://xoso-api.webviet.vn/api-tructiep.php?region=mn Kết quả trực tiếp MN (NO-CACHE)
GET LIVE MT https://xoso-api.webviet.vn/api-tructiep.php?region=mt Kết quả trực tiếp MT (NO-CACHE)
GET LIVE MB https://xoso-api.webviet.vn/api-tructiep.php?region=mb Kết quả trực tiếp MB (NO-CACHE)

Tham Số Phụ (Filters)

  • province=slug : Lọc theo tỉnh (VD: ?region=mn&province=ben-tre).

"Automatic Update System"

Cấu Hình Cron Job

Để hệ thống tự động cập nhật, bạn cần thiết lập 2 Cron Job sau trên Hosting/VPS của mình.

1. Main Cron (Lịch Sử)

Chạy 1 lần mỗi ngày để chốt sổ.

Thời gian: 20:00 hàng ngày

0 20 * * * php /path/to/public/cron-main.php

2. Live Cron (Trực Tiếp)

Chạy mỗi phút trong giờ quay.

Thời gian: 16h15 - 18h30

* 16-18 * * * php /path/to/public/cron-tructiep.php

Ngoài ra, bạn có thể chạy php cron-bulk-import.php 365 để khôi phục dữ liệu 1 năm cũ nếu cần.

Code Mẫu Tích Hợp

JavaScript (Fetch)

fetch('https://xoso-api.webviet.vn/api.php?region=mn')
  .then(res => res.json())
  .then(data => console.log(data))
  .catch(console.error);
      
// Navbar function myFunction() { var x = document.getElementById("navDemo"); if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; } else { x.className = x.className.replace(" w3-show", ""); } } // Tabs function openCode(evt, cityName) { var i, x, tablinks; x = document.getElementsByClassName("city"); for (i = 0; i < x.length; i++) { x[i].style.display="none" ; } tablinks=document.getElementsByClassName("tablink"); for (i=0; i < x.length; i++) { tablinks[i].className=tablinks[i].className.replace(" w3-red", "" ); } document.getElementById(cityName).style.display="block" ; evt.currentTarget.className +=" w3-red" ; } // Live Demo Utility async function runDemo() { const region=document.getElementById('demoRegion').value; const type=document.getElementById('demoType').value; const resultBox=document.getElementById('demoResult'); const jsonBox=document.getElementById('demoJson'); const urlLabel=document.getElementById('demoUrl'); const statusLabel=document.getElementById('demoStatus'); resultBox.style.display='block' ; jsonBox.innerText='Fetching...' ; const url='https://xoso-api.webviet.vn/' + type + '?region=' + region; urlLabel.innerText=url; try { const res=await fetch(url); const data=await res.json(); statusLabel.innerText='Success (' + res.status + ')' ; statusLabel.className='w3-text-green' ; jsonBox.innerText=JSON.stringify(data, null, 2); } catch (e) { statusLabel.innerText='Error' ; statusLabel.className='w3-text-red' ; jsonBox.innerText=e.message; } }