Android Question PostString to php web service

gjt

Member
Licensed User
Longtime User
I'm struggling with PostString to a php web service.
B4X:
    Dim post_params As String
    Dim su          As StringUtils
    post_params = "device_id="& su.EncodeUrl(data_arr(0),"UTF8") & _
                 "&club_id=" & su.EncodeUrl(data_arr(1),"UTF8") & _
                 "&seq="     & su.EncodeUrl(data_arr(2),"UTF8") & _
                 "&str="     & su.EncodeUrl(data_arr(3),"UTF8") & _
                 "&args="    & su.EncodeUrl(data_arr(4),"UTF8")


send_job.PostString(linkstr, post_params)
The problem is with the args parameter, which is a jason formatted string, such as:
data_arr(4) = ["Daniel Edward","941148000000","M",36,1389102979737]

In the php web service...
B4X:
$args      = urldecode($_POST["args"]);

$args is now [\"Daniel Edward\",\"941148000000\",\"M\",36,1389102979737]

So the double quotes is escaped with the backslash.
I can add some code to fix $args, however what was sent is not what I get out the other side.
How should I do this? (I don't want to split args into separate post variables).

Thanks
John
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
And you dont need urldecode cause it is not part of the url.
Use a standard POST or GET-Call with httputils2 should be ok for that....
 
Upvote 0

gjt

Member
Licensed User
Longtime User
Yes, I initially coded without the EncodeURL, but it produces the same result.
Yes, I'm using httputil2 PostString

Guess, I'll code around it.

Thanks
 
Upvote 0
Top