Android Question Request GET/POST data from PHP script

ThRuST

Well-Known Member
Licensed User
Longtime User
I want to collect user input string data from questions in an HTML page on a server that is mixed with PHP. How can I recieve the result in android when sending back through GET or POST? Please provide examples for both any of the HTTP libs and the webview. Which one should I use? I've seen postings about a couple of libs around, HTTP, HTTPutils, HTTPUtils2, OkHTTP, OKHTTPutils etc maybe it is possible to also load a webpage from the assets folder to handle the variables without any libs if the above method is not possible. Thanks for sorting this out.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
There's not many examples on the new okHttpUtils2 do you mind providing and/some examples on how to use it?
It would be great to clearify out the difference between those HTTP libs, since they are still part of the libraries folder in the IDE.

Throught my question I am confused how to read a users data from a webpage through POST. I have no idea how to check the
results from a user typing in a INPUT textfield and have B4A process the data, since it is all handled by the PHP script on a server.

Any clues is welcomed here. Thanks alot Erel.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There's not many examples on the new okHttpUtils2 do you mind providing and/some examples on how to use it?
It would be great to clearify out the difference between those HTTP libs, since they are still part of the libraries folder in the IDE.
The API is the same. Code you see for HttpUtils2 will work with OkHttpUtils2. OkHttpUtils2 is based on OkHttp library. This is a newer library that replaces the older Http library.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Great. Excuse me for my lack of knowledge regarding the HttpUtils2 lib, but is it possible to have B4A to catch server POST data without the need to first store the results in a database? i.e MySQL, JSON and JSONParse seems to be the only 'official' way to handle interaction between android and the server? Erel please reply
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
i.e MySQL, JSON and JSONParse seems to be the only 'official' way to handle interaction between android and the server?
Where did you see such a statement????

You can implement the server in any way you like. The client sends a request and receives a response. It doesn't matter to the client how the server is implemented.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Erel, it's from the link in reply #5. I found a tutorial by well-known member KMatle. He published a three part tutorial on HttpUtils2 lib which I refer to.
All I want to do is to have 1.the user fill out a simple HTML form with PHP i.e textfields with name and age and 2.when user is done it is sent through POST
but I still have no idea how 3. B4A can use HttpUtils2 lib and figure out what's in the fields. Perhaps REQUEST is the answer to solve this? Cheers
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…