Facebook scrambling for data

I use the Facebook application, which has a rich set of information that I would like to receive offline. To do this, I essentially need to read information from web pages in my own database. Obviously, I would prefer not to save the pages manually and let my application read the pages and extract relevant data from them. Unfortunately, I was blocked on the road by the requirement to first authenticate with Facebook. Therefore, when I run this code:

private static string getPage(string pageAddress)
{
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(new Uri(baseUri, pageAddress));
    HttpWebResponse response = (HttpWebResponse)req.GetResponse();
    StreamReader readStream = new StreamReader(response.GetResponseStream());
    string page = readStream.ReadToEnd();
    readStream.Close();
    response.Close(); // I know, I'm paranoid and this is likely redundant...
    return page;
}

I get this answer:

<script type="text/javascript">
if (parent != self) 
top.location.href = "http://www.facebook.com/login.php?api_key=<obscured>&canvas&v=1.0";
else self.location.href = "http://www.facebook.com/login.php?api_key=<obscured>&canvas&v=1.0";
</script>

Any ideas how to tell the app that I'm really authentic?

+3
source share
5 answers

Facebook REST, ; JavaScript API. ; rest_server.php? = .

http://www.facebook.com/developers, // , facebook.

+3

API facebook facebook.

+1

script facebook. cookie, .

- curl php. ( cookie)

+1

I think they use cookies for authentication, so first you need your Facebook login application and save the cookie in CookieContainer, then assign it to req.CookieContainer and only then req.GetResponse ();

+1
source

Source: https://habr.com/ru/post/1726047/


All Articles