Facebook发布关于标题和描述的页面问题

时间:2017-11-15 20:50:45

标签: php facebook facebook-graph-api

我想发布到Facebook页面。一切都与" Title"和"描述"。

我使用以下代码发布。

    $sql = "SELECT * FROM social_settings WHERE id = 1";
    $result = $con->query($sql);
    $row = $result->fetch_assoc();

    $fb = new Facebook\Facebook([
     'app_id' => $row['facebook_app_id'],
     'app_secret' => $row['facebook_app_secret'],
     'default_graph_version' => 'v2.2',
    ]);

    $linkData = [
        'link' => 'http://www.example.com/property/detail/'.$property_id,
        'message' => $title,
        "source" => 'http://www.example.com/images/image.jpg'
    ];

    try {
        $response = $fb->post('/me/feed', $linkData, $row['facebook_token']);
    } catch(Facebook\Exceptions\FacebookResponseException $e) {
        echo 'Graph returned an error: '.$e->getMessage();
        exit;
    } catch(Facebook\Exceptions\FacebookSDKException $e) {
        echo 'Facebook SDK returned an error: '.$e->getMessage();
        exit;
    }
    $graphNode = $response->getGraphNode();

我还使用以下OG数据;

    <meta property="og:type"            content="article" />
    <meta property="og:title"           content="<?php echo $title; ?>" />
    <meta property="og:site_name"       content="Example">
    <meta property="og:url"             content="http://www.example.com/property/detail/<?php echo $property_id; ?>" />
    <meta property="og:image"           content="http://www.example.com/<?php echo $image; ?>" />
    <meta property="og:image:type"      content="image/jpg" />
    <meta property="fb:app_id"          content="XXXXXXXXXXXXXXX"/>
    <meta property="og:description"     content="<?php echo $desc; ?>" />

当我检查cource代码时,所有内容都被正确回显。

现在的问题是,当我打开Facebook页面时,会发布链接,消息和来源,但在图像下方,它也会显示&#34;标题&#34;和&#34;描述&#34;

见图像;

Screen shot of facebook page post

如何更改TITLE和DESCRIPTION?

0 个答案:

没有答案