I'm having trouble downloading specific webpages using C#. I'd like to download public transport timetables from this page: https://rozklady.mpk.krakow.pl/?lang=EN
When you click a line (e.g. "1") and choose a stop (e.g. the 1st one), the address becomes: https://rozklady.mpk.krakow.pl/?lang=EN&rozklad=20230204&linia=1__1__1 and this is what I'd like to download.
I tried the code below:
string url = "https://rozklady.mpk.krakow.pl/?lang=EN&rozklad=20230204&linia=1__1__1";
HttpClient client = new HttpClient();
using (HttpResponseMessage response = client.GetAsync(url).Result)
{
using (HttpContent content = response.Content)
{
string page = content.ReadAsStringAsync().Result;
File.WriteAllText("page.htm", page);
}
}
However it only downloads the "starting" page instead: https://rozklady.mpk.krakow.pl as if characters after "/?" in the string were skipped. I also tried using verbatim string with "@" in front of "https...", with no result.
Do you have any suggestions? I'm not even sure if it's a C# issue, or something to do with how the webpage is created?