简体   繁体   中英

Changing group cover image using fb graph api

I want to change the cover image of group created via graph API. Here is the code that I used but it give me error. I am using app access token.

$response = $facebook->api('/Groupid', "POST", 
    array (
        'access_token' => $app_token,
        'cover_url' => 'calnder.png'
    )
);

Fatal error: Uncaught OAuthException: An unknown error has occurred. thrown in /home/groupsme/public_html/base_facebook.php on line 959

Can somebody tell me about my fault please ?

I think the cover_url should be an absolute path to an image.

Please test it via Graph explorer first. Access token will be app token means

$app_token = $app_id | $app_secret;
$cover_url = "http://dummyimage.com/600x400/000/fff";

then do this

$response = $facebook->api('/GROUP_ID', "POST", array ( 'access_token' => $app_token,'cover_url' => $cover_url ));
print_r($response);

For reference see the graph explorer screenshot

图浏览器的屏幕截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM