简体   繁体   English

使用 NodeJS 从另一个网站访问 forms

[英]Access forms from another website using NodeJS

How can i use NodeJS to update forms from someone else's website?我如何使用 NodeJS 从别人的网站更新 forms?

example) A forum website lets you make posts with no account, how can i use nodeJS to write what i want to post as a string, then submit it to the forum using nodeJS?例如)一个论坛网站可以让您在没有帐户的情况下发布帖子,我如何使用 nodeJS 将我想要发布的内容写为字符串,然后使用 nodeJS 将其提交到论坛?

example of code from 3rd party website:来自 3rd 方网站的代码示例:

<form id="msg" class=" msgc" method="post" action=" " enctype="multipart/form-data">
<input type="text" id="texter" />
<input type="submit" id="submitter" />
</form>

You can use Axios and a post request.您可以使用 Axios 和发布请求。 Anyways I don't think that it actually works if they have properly set the CORS policy.无论如何,如果他们正确设置了 CORS 策略,我认为它实际上不会起作用。

axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
 })
     .then(function (response) {
     console.log(response);
})
     .catch(function (error) {
     console.log(error);
});

See AxiosAxios

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM