Skip to content
Advertisement

send data using flutter-inappwebview to web page

I’m using inappwebview package, which opens a web page. I want to receive some data from my Flutter app to my web page (php/html) or there’s may be some better option? Basically the user select a product in the app and then the inappwebview package will open this web page to show some specific products).
I have found that inappwebview postData: “Loads the given [url] with [postData] using POST method into this WebView” and what I have tried is;

JavaScript

And in web page (php) I don’t know how this data receives, I tried to write it like this;

JavaScript

Which is not correct i guess. Please help me!

Advertisement

Answer

The postData argument represents the Body of the HTTP POST request.

A simple example using the latest version 5.0.5+3 of the flutter_inappwebview plugin is:

JavaScript

where the postData is the Body of the request in x-www-form-urlencoded format.

So, in your PHP server, you can access the firstname and lastname values as you normally would do, that is $_POST['firstname'] and $_POST['lastname'].

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement