Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Graph api-发布图像时的个人故事_Php_Facebook Graph Api - Fatal编程技术网

Php Graph api-发布图像时的个人故事

Php Graph api-发布图像时的个人故事,php,facebook-graph-api,Php,Facebook Graph Api,我正在使用此代码将图片发布到FB墙。但当我发布4张或更多照片时,故事会折叠在一起并显示“(页面名称)在相册中添加了4张照片…”。。。有没有一种方法可以让每一张图片都有自己的故事 $postdata = http_build_query( array( 'access_token' => $token, 'message' => $mes, 'url' => $img ) ); $opts = array('http' => array(

我正在使用此代码将图片发布到FB墙。但当我发布4张或更多照片时,故事会折叠在一起并显示“(页面名称)在相册中添加了4张照片…”。。。有没有一种方法可以让每一张图片都有自己的故事

$postdata = http_build_query(
  array(
    'access_token' => $token,
    'message' => $mes,
    'url' => $img
  )
);
$opts = array('http' =>
  array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result = file_get_contents('https://graph.facebook.com/'.$album_id.'/photos', false, $context);

所以我通过上传没有故事的照片,然后分享来解决这个问题。你可以分享你想要的任意多张图片,但它仍然是一篇文章

$postdata = http_build_query(
  array(
    'access_token' => $token,
    'message' => $mes,
    'url' => $img,
    'no_story' => '1'
  )
);
$opts = array('http' =>
  array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result = json_decode(file_get_contents('https://graph.facebook.com/'.$album_id.'/photos', false, $context));

$postdata = http_build_query(
  array(
    'access_token' => $token,
    'is_hidden' => 'true'
  )
);
$opts = array('http' =>
  array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result2 = file_get_contents('https://graph.facebook.com/'.$result->id, false, $context);

$postdata = http_build_query(
  array(
    'access_token' => $token,
    'link' => 'http://www.facebook.com/photo.php?fbid='.$result->id
  )
);
$opts = array('http' =>
  array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result3 = file_get_contents('https://graph.facebook.com/'.$id.'/feed', false, $context);

每张照片都有各自的故事。Facebook只是在大多数用户的新闻提要中将它们压缩成一个故事。不,没有任何方法可以强制这些图片显示每张图片的完整故事。如果您手动发布,请单击页面上的“发布照片/视频”链接,它会单独显示。。。但是你说graph api没有办法,对吗?