Sending a value parameter through http.post

Trying the following code segment in the weather example:

local req = http.post(“http://www.___.net/imp/impPush.php?sunmsg=”+weather.city,
{ “Content-Type”:“application/x-www-form-urlencoded” }, “”)
req.sendasync(function(response) {
device.send(“success”, response.statuscode);
server.log(weather.city)
});

I get a statuscode of 200 which I assume everything is ok but the value of weather.city never gets sent. I have also tried putting weather.city where the value parameter goes, the “” in my example, but nothing happens.
Any ideas?

Another weird thing is that even if you put a bogus URL you still get a status 200. Why?

I think sunmsg="+weather.city needs to go in the body not in the url as query string. I’m posting like that and it works.
local req = http.post("http://www.___.net/imp/impPush.php { "Content-Type":"application/x-www-form-urlencoded" }, "sunmsg="+weather.city)
Also for this type of testing I find http://requestb.in helps see what your outputing

Thanks. I keep getting an error “newline in a constant” on the first line. If I put a quote and a comma after the .php no error but nothing gets sent. Any ideas?

What event/where are you trying to send it from?

Near the end of the getconditions function in the weather example, right after device.send(“new data”,forecasting);

Got it to work added a " after php.