Advertisement
Guest User

Untitled

a guest
May 31st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function PostCode2() {
  2. // Build the post string from an object
  3. var post_data = querystring.stringify({
  4. "apikey": "f4f561c9ffdfc1666ef1189920bf7efc9abb58ca",
  5. "text": "Best android mobile phone",
  6. "sentiment": 1,
  7. "keywordExtractMode": "strict",
  8. "outputMode": "json",
  9. });
  10.  
  11. // An object of options to indicate where to post to
  12. var post_options = {
  13. url: "http://gatewaya.watsonplatform.net/calls/text/TextGetRankedKeywords",
  14. method: 'post',
  15. body: JSON.stringify(post_data)
  16.  
  17. };
  18.  
  19. // Set up the request
  20. var post_req = http.request(post_options, function(res) {
  21. // res.setEncoding('utf8');
  22. res.on('data', function (chunk) {
  23. console.log('Response: ' + chunk);
  24. });
  25. });
  26.  
  27. // post the data
  28. post_req.write(post_data);
  29. post_req.end();
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement