Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PostCode2() {
- // Build the post string from an object
- var post_data = querystring.stringify({
- "apikey": "f4f561c9ffdfc1666ef1189920bf7efc9abb58ca",
- "text": "Best android mobile phone",
- "sentiment": 1,
- "keywordExtractMode": "strict",
- "outputMode": "json",
- });
- // An object of options to indicate where to post to
- var post_options = {
- url: "http://gatewaya.watsonplatform.net/calls/text/TextGetRankedKeywords",
- method: 'post',
- body: JSON.stringify(post_data)
- };
- // Set up the request
- var post_req = http.request(post_options, function(res) {
- // res.setEncoding('utf8');
- res.on('data', function (chunk) {
- console.log('Response: ' + chunk);
- });
- });
- // post the data
- post_req.write(post_data);
- post_req.end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement