webrequest - How can I fetch full name and picture from any user's Facebook page? -
I want to access public information about any user on Facebook. Actually, it means only user image and full name, all this is. When you open a page without logging in, it is such information:
However, when I try to do this with code, Facebook gives this message Is:
"You are using an incompatible web browser."
I'm trying to duplicate a Firefox browser, but that does not work. Am I doing something wrong? Or is using other techniques to block Facebook?
var requestString = "http://www.facebook.com/jurgenappelo"; Var Request = (HttpWebRequest) WebRequest.Create (requestString); Request.Headers.Add ("HTTP_USER_AGENT", "Gecko / 20050511 Firefox / 1.0.4"); Try {HttpWebResponse response = (HttpWebResponse) request.GetResponse (); If (response! = Null) {if (response status code == htmlttatus code.OK) {stream stream = response. Gateresonsstream (); (StreamReader Reader = new streamrider (stream)) using {var html = reader.ReadToEnd (); }} Response.Close (); According to this:
/ P>
You should try to change it:
request.Headers.Add ("HTTP_USER_AGENT", "Gecko / 20050511 Firefox / 1.0.4"); From
:
request.UserAgent = "Gecko / 20050511 Firefox / 1.0.4";
Comments
Post a Comment