I have a system developed in Android Studio and I am passing to Xamarin Forms in C # and there are some errors that I can not solve
Summarizing what my system does: It takes the html page and transcribes line by line from the html so I can do some checks.
Here are the lines that I'm having trouble with:
if (httpURLConnection.getResponseCode () == 200) non-existent getResponseCode InputStream inputStream = new BufferedInputStream (httpURLConnection.getInputStream ()); getInputStream () does not exist
BufferedReader bufferedReader = new BufferedReader (new InputStreamReader (inputStream, "UTF-8"));
public string GetDados(string urlString)
{
string dados = string.Empty;
try
{
URL url = new URL(urlString);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.OpenConnection();
if(httpURLConnection.getResponseCode() == 200)
{
InputStream inputStream = new BufferedInputStream(httpURLConnection.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder stringBuilder = new StringBuilder();
string linha;
while ((linha = bufferedReader.ReadLine()) != null)
{
stringBuilder.Append(linha);
}
dados = stringBuilder.ToString();
httpURLConnection.Disconnect();
}
}
catch (IOException erro)
{
return null;
}
return dados;
}