I have this simple cUrl command that i want to implement into node red but can't get to work. i have tried a couple of examples, but just cant get the data required. the command works ok in terminal to retrieve location data of an ip address:
curl ipinfo.io/8.8.8.8?token=1234567890
i am wanting to be able to put the ip address in as msg.payload. I create a JSON object, and send it into a http post node, but don't get the message header thing ???
latest non working function.....
//original curl format:
//
//curl ipinfo.io/8.8.8.8?token=1**********
/*returns
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"anycast": true,http://192.168.0.20:1880/#func-tab-finalize
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4056,-122.0775",
"org": "AS15169 Google LLC",
"postal": "94043",
"timezone": "America/Los_Angeles"
}
*/
msg.method = "post";
msg.url = "http://ipinfo.io/";
msg.payload = "8.8.8.8";
msg.token = "my-token-here";
msg.headers = null;
msg.cookies = null;
return msg;