Need to get HTML from any add out of these: https://www.avito.ru/moskva/kvartiry?user=1
I have the following code:
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);
Request.ProtocolVersion = HttpVersion.Version11;
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36";
Request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*;q=0.8";
Request.Headers.Add(HttpRequestHeader.AcceptLanguage, "ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4");
Request.Method = "GET";
Request.Timeout = 10000;
using (HttpWebResponse Response = (HttpWebResponse)Request.GetResponse()) { ...;}
It used to work just fine untill today. Apparently they have changed something at their web-site and now the last line of the code throw an error, which says:
System.Net.WebException: Base connection is closed: inexpected error at transfer. ---> System.IO.IOException: connection error because of inexpected packet format.
The thing is, I still have good response from the link at the top.
But it throws an exception at response from something like https://www.avito.ru/moskva/kvartiry/2-k_kvartira_54_m_1617_et._555913941
Any Ideas?
ps. error message can be inexact as it's translated. My excuses for grammar..
The server droped my requests because I forgot to add "www." to the domain-name for composed url's.. Guys, keep an eye on details.