尝试使用 PHP cURL 时无法获取 Facebook 页面源代码

Not able to get the Facebook page source code when trying and using with PHP cURL

我试图获取以下 Facebook 页面的源代码 - https://www.facebook.com/video.php?v=974372955923474&set=vb.213776828649761&type=2&theater。但它从来没有 returns 实际页面的源代码,相反,它 returns 形成 'Update your browser' 页面的源代码,看来我使用了错误的用户代理,但是我将用户代理更改为最新版本的 Chrome,但它仍然无法正常工作。

// Set curl option - following location - prevent redirects 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

    // Set curl option - retransfer
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    // Set curl option - no header
    curl_setopt($ch, CURLOPT_HEADER, false);

    // Set curl option - no body
    curl_setopt($ch, CURLOPT_NOBODY, false);

    // Set curl option - user agent
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); // Necessary. The server checks for a valid User-Agent.

    // Execute CURL and get the response
    $curlResponse = curl_exec($ch);

我认为您需要为此提供登录信息。我的浏览器中没有登录 Facebook 帐户,但我需要登录。我没有看到您的 PHP 代码中提供的任何登录信息。我认为如果您需要从 Facebook 检索信息或媒体,您需要查看 Facebook API