Comma delimited string to http request

I am sending a comma delimited string to an http request. I have a LAPP environment setup and the piece of php I wrote is receiving something, but it claims it can not find the values I look for using $_POST.
Here is what happens in squirel:
local output = OutputPort("value","string"); imp.configure("Simple Serial", [], [output], {}); output.set(mystring);
in php I check for $_POST(‘value’) $_POST(‘channel’) and $_POST(‘target’) but it can not find any of these values/indexes ?
I used this example : http://devwiki.electricimp.com/doku.php?id=plannerhttprequest
I have the content type set to application/JSON in the http request.
Am I missing something ? The string is about 75 characters long.

Two things:

  1. If you’re working with HTTP Requests, you should be using the beta - it makes everything a lot more clear (send an email to info@electricimp.com to get on the beta)
  2. requestb.in is your friend when you’re having issues with http requests you are making :slight_smile: Basically, you setup a temporary “request bin,” which an URL, and you can inspect whatever gets sent to that bin. It allows you to see what the body actually looks like, what’s in the headers, etc

@beardedinventor,
I requested to be added to the beta yesterday. I did see some of the agent examples and it seems like a big improvement.
Thanks for the tip about requestb.in I will give it a try later ! That sounds like the perfect way to see what’s going on !

Awesome, I haven’t gotten around to setting up betas yet today, but it’s on my list for this morning. Expect an email shortly :slight_smile:

Thank you !

FYI, requestb.in was aquired by Runscope which can serve as a transparent bridge to see BOTH the request and response. Its a pretty powerful little tool for debugging.

great tool. I put my call into requestbin and it shows I only sent the actual string ?
this is my new code:
// Agent code device.on("arduino_gps", function(sddata) { http.put("http://requestb.in/blaaaa", { "Content-Type": "application/json" }, http.jsonencode(sddata) ).sendsync(); });

Anyone ?
I only see the raw data at requestbin. Doesn’t seem like anything happens to encode.
Anyone know what type of data the encoder expects ? any examples ?

What is the “sddata” object? jsonencode is expecting a table.

sddata is a string.
Any restrictions/requirements for the table?

So json encoding a string is just… a string. Quotes will be added, and stuff will be escaped, but that’s it.

if you do server.log(http.jsonencode({ param1=23, param2=“value” })); then you’ll see:

{ “param2”: “value”, “param1”: 23 }

…which is that table JSON encoded.