我正在尝试在 LUA 中编写一个函数来编辑我的 pastebin 代码。
我可以使用此代码生成 HTTP post:
http.post(string url, string postData [, table headers])
我还可以将此代码用于 HTTP 获取:
http.get(string url [, table headers])
在 Pastebin 网站上 https://pastebin.com/api 是关于使用 API 的信息。 我不确定这个网站是否可以帮助我解决问题。
有人知道如何填写标题表吗?
这是我试过的程序:
headers = {}
headers["api_dev_key"]= 'myDevKey...'; // your api_developer_key
headers["api_paste_code"] = 'my edited text'; // your paste text
headers["api_paste_private"] = '0'; // 0=public 1=unlisted 2=private
headers["api_paste_name"] = 'justmyfilename.php'; // name or title of your paste
headers["api_paste_expire_date"] = '10M';
headers["api_paste_format"] = 'php';
headers["api_user_key"] = ''; // if an invalid or expired api_user_key is used, an error will spawn. If no api_user_key is used, a guest paste will be created
headers["api_paste_name"] = myPastebinName;
headers["api_paste_code"] = myPastebinPassword;
http.get("https://pastebin.com/edit/dQMDfbkM", headers)
不幸的是,这不起作用,并且在 pastebin API 帮助站点上没有用于编辑粘贴的示例。只是为了创建一个新的。
对我来说,我也不清楚我是否必须使用 post 或 get
最佳答案
没有直接编辑粘贴的 API。
您只能删除旧的粘贴并使用更新的文本创建新的粘贴。
关于http - 通过 API 编辑现有的 Pastebin 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48332389/