Page 1 of 1
HTTP post return adding 0 at the end.
Posted: Tue Oct 07, 2014 5:02 pm
by CoreStylerz
I don't know why, i'm getting wrong values return in flowstone.
The error is flowstone add a 0 at the end of the returned string.
I'm still investigating but the php script (i checked it) doesn't give this 0 at the end while the returned http-post string yes!
Anyone had the same issue?
PS i checked once more.
Flowstone add a 0 at the end of the numeric string WTF.
Re: HTTP post return adding 0 at the end.
Posted: Thu Oct 09, 2014 1:54 pm
by Drnkhobo
Hey CS I have had the same problem. No matter what I do FS always adds the 0 at the end of returned string. I simply made a Ruby to remove it. . . havent found any other solution. I think its a problem within the HTTP prim itself...

Re: HTTP post return adding 0 at the end.
Posted: Thu Oct 09, 2014 9:30 pm
by CoreStylerz
Drnkhobo wrote:Hey CS I have had the same problem. No matter what I do FS always adds the 0 at the end of returned string. I simply made a Ruby to remove it. . . havent found any other solution. I think its a problem within the HTTP prim itself...

The problem is that sometimes doesn't happen! That it's bad because you can't return correct values from php to be always stable..
Hey support can you give us some info? a fix or maybe a workaround?
If i undestand WHEN it add this 0 will be cool
Re: HTTP post return adding 0 at the end.
Posted: Thu Oct 09, 2014 10:24 pm
by tulamide
Text encoding issues? Maybe the server returns something else then ASCII.
Or the char[] gets messed up? (Since "\0" marks the end of a c string)
HTTP POST example with Client Primitive
Posted: Sat Oct 11, 2014 2:37 am
by Tronic
Not tested, but should work ...
use this ruby code with Client Primitive.
Code: Select all
# TRONIC - HTTP POST EXAMPLE - use it with Client Primitive
# see HTTP protocol for more info
header = "POST /your-url-where-post HTTP/1.1\r\n"
header+= "User-Agent: FLOWSTONERS DEVELOPER\r\n"
header+= "From: user@server.mail\r\n" # optional
header+= "Content-Type: application/x-www-form-urlencoded; charset=us-ascii\r\n"
header+= "Content-Length: #{@body.size}\r\n" # set size accordly to lenght of body text
header+= "Accept: text/plain\r\n" # or other Type
header+= "Accept-Charset: us-ascii\r\n"
header+= "Accept-Language: en-us\r\n"
header+= "Connection: Keep-Alive\r\n"
header+= "\r\n" # end header
# body is url encoded
# Example: parameter=value&also=another
@body = "MACHINEID=123456789&EMAIL=user@server.mail"
request = header + @body
request_as_txt = request
request_as_hex = request.unpack('H*')
output 0, request_as_txt # use as txt Type in Client Primitive
output 1, request_as_hex # use as hex Type in Client Primitive
Re: HTTP post return adding 0 at the end.
Posted: Sun Oct 12, 2014 6:25 pm
by CoreStylerz
Encoding a string to base64 will solve this? (decoding then in flowstone)
Re: HTTP post return adding 0 at the end.
Posted: Mon Oct 13, 2014 8:00 pm
by Tronic
depends on how you structured your php code when you create your data before convert it to EncodedBase64.
Re: HTTP post return adding 0 at the end.
Posted: Tue Oct 14, 2014 11:39 am
by CoreStylerz
working well encoding data with base64.