如何下载Facebook页面?

I want to download a Facebook web page using PHP. I've tried file_get_contents along with stream_context_create. I've also tried Curl. But Facebook is returing only this message:

Update Your Browser You’re using a web browser that isn’t supported by Facebook. To get a better experience, go to one of these sites and get the latest version of your preferred browser:

Am I missing anything?

Here is the Curl code:

       $url="https://www.facebook.com/media/set/?set=a.189662541197403.1073741845.188398434657147&type=1&l=a8755a774e";
        $custom_headers = array();
        $custom_headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
        $custom_headers[] = "Pragma: no-cache";
        $custom_headers[] = "Cache-Control: no-cache";
        $custom_headers[] = "Accept-Language: en-us;q=0.7,en;q=0.3";
        $custom_headers[] = "Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7";

        $ch = curl_init();
        $useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1";
        curl_setopt($ch, CURLOPT_USERAGENT, $useragent); // set user agent
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers);

        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 40); //timeout in seconds

        $txResult = curl_exec($ch);

        $statuscode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        print "$txResult";

Use the API instead?

The data for the URL you mentioned can also be retrieved from this one:

http://graph.facebook.com/?id=189662541197403

Also, that reduces your entire code to this line :

json_decode(file_get_contents('http://graph.facebook.com/?id=189662541197403'));

facebook Api have some restication about fb data

if you want scrap Facebook page you need wait until all of the Javascript is loaded before curling the page

You need to use a headless browser engine to do this. cURL and wget are HTTP libraries; they speak HTTP and download documents as String. They don't have a concept of a DOM or a JavaScript engine that would help them understand that a page is doing AJAX OR JS . So to download the HTML, you need something that acts more like a browser, by parsing a DOM and executing JS. I recommend http://simile.mit.edu/wiki/Crowbar, which uses a Mozilla engine. once the js run you easily scrap content you want

I hope this is help-full for you :)