Skip to content

Instantly share code, notes, and snippets.

@malte-j
Last active April 10, 2018 20:06
Show Gist options
  • Save malte-j/b45888aa18ee75520a25c3017d257118 to your computer and use it in GitHub Desktop.
Save malte-j/b45888aa18ee75520a25c3017d257118 to your computer and use it in GitHub Desktop.
const request = require('request');
// Request Header
var headers = {
'User-Agent': 'Secret Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
}
// Liste der comments
const comments = [
{
name: 'Max Mustermann',
text: 'Lorem Ipsum'
},
{
name: 'Maxi Musterfrau',
text: 'Dolor Sit Amet'
}
]
// Posten
comments.forEach(comment => request({
url: 'http://www.hgotv.herbartgymnasium.de/',
method: 'POST',
headers: headers,
form: {
nicknameInput: comment.name,
commentInput: comment.text,
mathInput: 12
}
}, (err, res, body) => console.log(err? err : 'success')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment