import requests import time # --- 基础配置 --- API_URL = "http://199.119.14.24/index.php" APP_ID = "1" APP_SECRET = "PHPCMFA1A4A43E2A3A8" def final_success_test(): # 路径参数 params = { "s": "httpapi", "m": "insert", "appid": APP_ID, "appsecret": APP_SECRET } # 核心修正:table 填 news # 后台权限填 * 确保了校验通过 # 系统自动加前缀后变成 dr_news,正好匹配数据库 data = { "table": "news", "value[catid]": 7, "value[title]": "2026厦门食品展会自动化发布测试", "value[content]": "

链路已打通。准备对接2026年3月29-31日展会数据。

", "value[status]": 9, "value[uid]": 1, "value[author]": "管理员", "value[inputtime]": int(time.time()), "value[updatetime]": int(time.time()) } try: response = requests.post(API_URL, params=params, data=data, timeout=10) print(f"服务器返回: {response.text}") res_json = response.json() if res_json.get("msg") == "ok": print("-" * 30) print(f"✅ 终于成功了!文章 ID: {res_json.get('code')}") print("-" * 30) else: print(f"❌ 依然报错: {res_json.get('msg')}") except Exception as e: print(f"🚫 错误: {e}") if __name__ == "__main__": final_success_test()