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();
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?
source
share