c# - How to submit the browser type when download a web stream -


my code :

string result = new webclient().downloadstring("https://www.facebook.com/profile.php?id=123456789"); 

the result giving me supported browser. body class=\"unsupportedbrowser

what intend do: download source code facebook particular page.

problem encounter : stream facebook, facebook block me since access apps due not valid browser.

expectation : how can submit browser type chrome cheat facebook valid browser.

you can add headers webclient object. however, prefer go httpwebrequest/httpwebresponse method of scraping since believe gives more options.

headers.add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");         headers.add("accept-encoding", "gzip, deflate");         headers.add("accept-language", "en-us,en;q=0.5");         headers.add("cookie", "has_js=1");         headers.add("dnt", "1");         headers.add("host", host);         headers.add("referer", url);         headers.add("user-agent", "mozilla/5.0 (windows nt 6.1; wow64; rv:32.0) gecko/20100101 firefox/32.0"); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -