Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

HTTP post return adding 0 at the end.

For general discussion related FlowStone

HTTP post return adding 0 at the end.

Postby CoreStylerz » Tue Oct 07, 2014 5:02 pm

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.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
User avatar
CoreStylerz
 
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy

Re: HTTP post return adding 0 at the end.

Postby Drnkhobo » Thu Oct 09, 2014 1:54 pm

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... :cry:
Drnkhobo
 
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: HTTP post return adding 0 at the end.

Postby CoreStylerz » Thu Oct 09, 2014 9:30 pm

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... :cry:

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
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
User avatar
CoreStylerz
 
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy

Re: HTTP post return adding 0 at the end.

Postby tulamide » Thu Oct 09, 2014 10:24 pm

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)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

HTTP POST example with Client Primitive

Postby Tronic » Sat Oct 11, 2014 2:37 am

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
Last edited by Tronic on Mon Oct 13, 2014 7:57 pm, edited 1 time in total.
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: HTTP post return adding 0 at the end.

Postby CoreStylerz » Sun Oct 12, 2014 6:25 pm

Encoding a string to base64 will solve this? (decoding then in flowstone)
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
User avatar
CoreStylerz
 
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy

Re: HTTP post return adding 0 at the end.

Postby Tronic » Mon Oct 13, 2014 8:00 pm

depends on how you structured your php code when you create your data before convert it to EncodedBase64.
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: HTTP post return adding 0 at the end.

Postby CoreStylerz » Tue Oct 14, 2014 11:39 am

working well encoding data with base64.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
User avatar
CoreStylerz
 
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy


Return to General

Who is online

Users browsing this forum: No registered users and 56 guests