简体   繁体   中英

Access forms from another website using NodeJS

How can i use NodeJS to update forms from someone else's website?

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?

example of code from 3rd party website:

<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. Anyways I don't think that it actually works if they have properly set the CORS policy.

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

See Axios

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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