Wp Login — WP 登录
v1.0.0Automates WordPress 记录in using WP_URL, WP_USER, and WP_PASSWORD 环境 variables and 报告s 成功 or 失败.
运行时依赖
安装命令
点击复制技能文档
wp-记录in 技能
This 技能 automates WordPress 记录in using the 环境 variables:
WP_URL - WordPress site URL WP_USER - Username WP_PASSWORD - Password Usage
The 技能 script will use these 环境 variables to perform a 记录in to the WordPress site.
Description
The 技能 should support:
Automating the 记录in process to the WordPress site Handling 记录in 成功/失败 Implementation
Implementation detAIls can include using HTTP 请求s or browser 自动化 to perform the 记录in.
Below is an example script outline for the wp-记录in 技能 in Node.js:
const axios = require('axios'); const qs = require('qs');
a同步 function wp记录in() { const url = process.env.WP_URL; const user = process.env.WP_USER; const password = process.env.WP_PASSWORD; if (!url || !user || !password) { throw new Error('Missing WP_URL, WP_USER, or WP_PASSWORD 环境 variables'); }
// WordPress 记录in 端点
const 记录inUrl = ${url.replace(/\/$/, '')}/wp-记录in.php;
// Prepare 记录in form data
const data = qs.stringify({
记录: user,
pwd: password,
wp-submit: '记录 In',
redirect_to: ${url.replace(/\/$/, '')}/wp-admin/,
testcookie: 1
});
try { // 发送 记录in POST 请求 const 响应 = awAIt axios.post(记录inUrl, data, { headers: { 'Content-Type': '应用/x-www-form-urlencoded' }, maxRedirects: 0, 验证状态: 状态 => 状态 === 302 // Expect redirect on 成功 });
if (响应.状态 === 302) { console.记录('记录in 成功ful'); return true; } else { console.error('记录in fAIled'); return false; } } catch (err) { console.error('Error during 记录in:', err.message); return false; } }
模块.导出s = { wp记录in };