我正在尝试编写Google应用脚本以向网站添加新用户。这是我的功能:
function sendPost() {
var url = "https://www.blackstonelaunchpad.org/users/sign_up";
var options = {
"method": "post",
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.8",
"cache-control": "no-cache",
"connection": "keep-alive",
"cookie": "cookievalye",
"origin": "https://www.blackstonelaunchpad.org",
"referer": "https://www.blackstonelaunchpad.org/users/sign_up",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36",
},
"payload": {
"utf8":"✓",
"authenticity_token":"C4KXrxZS7rOPT2cmnL2avpuq8BC7fhtz3rVVbwkjYvk=",
"user[program_ids]":"X",
"user[first_name]":"Test",
"user[last_name]":"Test",
"user[email]":"scriptTest@test.com",
"user[password]":"test",
"user[password_confirmation]":"test",
"button":"",
}
};
var response = UrlFetchApp.fetch(url, options);
Logger.clear()
Logger.log(response.getResponseCode());
}
执行脚本时,会返回200状态代码,但不会添加新用户。任何帮助将不胜感激。
答案 0 :(得分:0)
状态200代码成功。
您是否尝试使用POSTMAN传递它以查看它是否有效?