Php 文件\u获取\u内容无法打开流

Php 文件\u获取\u内容无法打开流,php,parsing,file-get-contents,Php,Parsing,File Get Contents,我已经检查了以前的相关线程,但我的问题涉及特定的可读性API。 我试图从网页上获得最相关的图片。我用红色的 这是我的密码: <?php define('TOKEN', "1b830931777ac7c2ac954e9f0d67df437175e66e"); define('API_URL', "https://www.readability.com/api/content/v1/parser?url=%s&token=%s"); function get_image($url) {

我已经检查了以前的相关线程,但我的问题涉及特定的可读性API。 我试图从网页上获得最相关的图片。我用红色的

这是我的密码:

<?php
define('TOKEN', "1b830931777ac7c2ac954e9f0d67df437175e66e");
define('API_URL', "https://www.readability.com/api/content/v1/parser?url=%s&token=%s");
function get_image($url) {
    // sanitize it so we don't break our api url
    $encodedUrl = urlencode($url);

    $TOKEN = '1b830931777ac7c2ac954e9f0d67df437175e66e';
    $API_URL = 'https://www.readability.com/api/content/v1/parser?url=%s&token=%s';
//  $API_URL = 'http://blog.readability.com/2011/02/step-up-be-heard-readability-ideas';
    // build our url
    $url = sprintf($API_URL, $encodedUrl, $TOKEN);
    // call the api
    $response = file_get_contents($url);
    if( $response ) {
        return false;
    }
   $json = json_decode($response);
    if(!isset($json['lead_image_url'])) {
        return false;
    }
    return $json['lead_image_url'];
}

echo get_image('https://www.facebook.com/');

?>

你似乎正在从Facebook获取内容


由于您的错误403禁止,我想说您的解析器/代码未被授权访问您正在访问的facebook页面,因此您由于隐私设置而被拒绝。

一个错误再清楚不过了:HTTP请求失败!HTTP/1.1 403禁止hh,但wamp服务器给出了给定错误..根据突出显示url的语法,url不在引号中。。。在这种情况下,readability.com网站没有身份验证/权限来查看您试图解析的facebook页面的内容,这对www.google.com和我测试的所有URL都会产生相同的错误。。哪个不使用fbcontent@Programming_crazy我仍然认为这是问题所在
Warning: file_get_contents(https://www.readability.com/api/content/v1/parser?url=https%3A%2F%2Fwww.facebook.com%2F&amp;token=1b830931777ac7c2ac954e9f0d67df437175e66e): failed to open stream: HTTP request failed! HTTP/1.1 403 FORBIDDEN in F:\wamp\www\inviteold\test2.php on line 16