My final goal is to write a simple program for myself. It should periodically checks the Thinkpad online store, and will send me an email if it finds any products meeting my criteria.
I’ve done some research. To get the content of a webpage I can use the code
WebRequest request = WebRequest.Create("http://www.google.com");
WebResponse response = request.GetResponse();
Stream data = response.GetResponseStream();
string html = String.Empty;
using (StreamReader sr = new StreamReader(data))
{
html = sr.ReadToEnd();
}
However for the online store website, I am not able to get the url of my desired page. The website url is in such format
I filter the result to only display New W series laptop, but the filter changes doesn’t affect the url in the browser address bar. What should I do?
To get anywhere, you should analyze the AJAX calls to the Lenovo Website (using Firebug or Chrome Developer Tools is a good start).
There you see that filter requests are sent to
http://outlet.lenovo.com/SEUILibrary/controller/e/outlet_us/LenovoPortal/en_US/catalog.workflow:GetCategoryFacetResults?q=1
then you’ll need to
POSTsome form data to that URL in order to get filtered results (which come back in HTML and you’ll have to parse that somehow).All this you can do by analyzing the AJAX calls.