Page 1 of 1

facebook give default page source when i fetched it with php

Posted: Mon Apr 26, 2010 8:30 pm
by mayanktalwar1988
when ever i try to read facebook page source they give some default page source

the title of default page stATES Incompatible Browser | Facebook..but the original title of index page is welcome to facebooK

the code used by me is this

Code: Select all

<?php
$url = "http://www.facebook.com";
$str = file_get_contents($url);

echo '<pre>';
echo htmlentities($str); 
?>
its seems like facebok is blocking this type of interaction..if that is the case then is there any other way to get facebook page source out .......because i have treid it on other site
and it works ok for it

Re: facebook give default page source when i fetched it with

Posted: Mon Apr 26, 2010 9:28 pm
by phu
Facebook has always had an API for this sort of thing. They just released a new version that's extremely simple to interact with:
Facebook OpenGraph API
Facebook PHP SDK on github