Issue
I am fairly new to (flutter) development and I have a question:
There is this website, and I would like to display the content in an app. As far as I understood the website, it is an server-site html render. Since there are no API's (atleast I didn't find them) which I can use to read the data, I wanted to get the whole html document and parse all of the "interesting" data out.
Do you have any idea how I get the html document so that I can start parsing? Or is there a more elegant solution to my problem?
Info: I don't want to make a html render, I have build my own UI and just want to insert specific data
Thanks a lot in advance!
Solution
I've just tested an http.get
request on Flutter to the url you specified and works well. I used this package to make the get request, I defined an async funcion to make the request and in the main
function of a Flutter app I call that function:
//This import the package
import 'package:http/http.dart' as http;
//...
//Here comes code of Flutter
//...
//Now I define the async function to make the request
void makeRequest() async{
var response = await http.get('https://speiseplan.app.itelligence.org/');
//If the http request is successful the statusCode will be 200
if(response.statusCode == 200){
String htmlToParse = response.body;
print(htmlToParse);
}
}
//...
//Here comes more Flutter code
//...
main(){
makeRequest();
}
This will print the html you want, as String and now you can parse it as you want.
Answered By - Ademir Villena Zevallos
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.