I need to download web page source code of some web site. Specifically I need to download the source as the mobile version. For example, for Facebook, the program should download the source code of m.facebook.com. Note that the URL
passed into the program is the normal URL
(facebook.com
, cnn.com
, etc.) I know how to download a normal webpage using URL
class but I did not see any mobile version switch in URL
class. Can anyone help me?
There is no switch. When you request the page you will need to adjust the headers that are sent with the http request. Such as the user agent-header. Make sure you follow any redirects that are returned.