小编Mar*_*ato的帖子

通过CURL发布到Facebook页面

我已经设置了一个脚本,通过PHP将新闻发布到我的Facebook页面

它工作了2年

现在,它没有通知它停止工作.

我正确得到了,access_token但第二部分返回此错误

{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
Run Code Online (Sandbox Code Playgroud)

这是代码

$url = "https://graph.facebook.com/oauth/access_token";
$postString = "client_id=KEY&client_secret=SECRET&type=client_cred";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FAILONERROR, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
$access_token = str_replace( "access_token=", "", curl_exec($curl) );


$titolo = 'Test';
$link_pulito = 'test.html';
$testo_fb = 'Test';

$attachment =  array(
        'access_token' => $access_token,
        'message' => 'MESSAGE',
        'name' => 'test',
        'link' => 'http://www.test.com/workshop/',
        'description' => 'test test test',
        'picture'=>'http://www.test.com/77818763a19937bdd82b25f26cef2522.jpg'
        );

// set the …
Run Code Online (Sandbox Code Playgroud)

php post curl facebook

5
推荐指数
1
解决办法
3401
查看次数

标签 统计

curl ×1

facebook ×1

php ×1

post ×1