Facebook Graph API PHP SDK posting on page as page

后端 未结 3 1948
深忆病人
深忆病人 2020-12-31 08:53

It\'s final try with PHP, if it fails, I\'ll try with JS. So my goal is to post on FB page as \"Page name\" through PHP: this is what I want to get

3条回答
  •  别那么骄傲
    2020-12-31 09:33

    $feed = '/v2.8/' . $pageID . '/' . "feed";
    $params = array(
     "access_token" => AQUI TU TOKEN // see: https://developers.facebook.com/docs/facebook-login/access-tokens/
    );
    $params[ "link" ] = "https://zapatillasnewbalancebaratas.blogspot.com/2018/11/zapatilla-new-balance-ml515-col.html";
    $params[ "message" ] = "Zapatilla New Balance Ml515 Col";
    $params[ "method" ] = POST;
    
    $graph_url = "https://graph.facebook.com" . $feed;
    
    
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $graph_url);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    
            $output = curl_exec($ch);
            echo $output;
            curl_close($ch);
    

提交回复
热议问题