Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.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
can';t在Facebook页面上发布照片';s时间线作为页面(PHP)_Php_Facebook_Facebook Graph Api_Facebook Page_Facebook Timeline - Fatal编程技术网

can';t在Facebook页面上发布照片';s时间线作为页面(PHP)

can';t在Facebook页面上发布照片';s时间线作为页面(PHP),php,facebook,facebook-graph-api,facebook-page,facebook-timeline,Php,Facebook,Facebook Graph Api,Facebook Page,Facebook Timeline,我想在五月Facebook页面的时间线上发布照片,作为页面而不是使用PHPSDK的用户 下面是我正在使用的示例代码 <?php include_once("config.php"); if($_POST) { if(strlen($_POST["message"])<1) {

我想在五月Facebook页面的时间线上发布照片,作为页面而不是使用PHPSDK的用户

下面是我正在使用的示例代码

            <?php
            include_once("config.php");

            if($_POST)
            {   
                if(strlen($_POST["message"])<1) 
                {
                    //message is empty
                    $userMessage = 'No message!';
                }
                //Post variables we received from user
                $userPageIds    = '00000000000000';

                $facebook->setFileUploadSupport(true);

                    $userMessage    = $_POST["message"];
                    //HTTP POST request to PAGE_ID/feed with the publish_stream
                    $post_url = '/'.$userPageId.'/albums';

                    //*
                    // posts message on page feed
                    $page_info = $facebook->api("/$userPageId?fields=access_token");

                $access_token = $facebook->getAccessToken();



                 // Get the new album ID
                 $albums = $facebook->api($userPageId.'/albums','GET',array('access_token'=>$access_token));      
             foreach($albums['data'] as $album)
             {
                echo $album['name'];
               if($album['name'] == 'Timeline Photos')
               {
                 $album_id = $album['id'];
               }
             }


                    $args = array(
                       'message' => $userMessage,
                       'image' => '@' . $_FILES['img']['tmp_name'],
                       'aid' => $album_id,
                       'no_story' => 0,
                       'access_token' => $page_info['access_token']
                      );

                if ($fbuser) {
                  try {
                        $postResult = $facebook->api('/'.$album_id.'/photos', 'post', $args);
                    } catch (FacebookApiException $e) {
                    echo $e->getMessage();
                  }
                }else{
                 $loginUrl = $facebook->getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>$fbPermissions));
                 header('Location: ' . $loginUrl);
                }

                //Show sucess message


            }

            ?>

此代码将照片添加到页面的时间线相册中,但它不会出现在页面的墙上

非常感谢您的帮助