Post Multiple photos Stories via Facebook API with PHP SDK

Today, We want to share with you Post Multiple photos Stories via Facebook API with PHP SDK.
In this post we will show you facebook api integration, hear for Publish Multi-Photo Stories using Facebook API with PHP SDK we will give you demo and example for implement.
In this post, we will learn about post a multiple photos via Facebook API with an example.

Post Multiple photos Stories via Facebook API with PHP SDK

There are the Following The simple About Post Multiple photos Stories via Facebook API with PHP SDK Full Information With Example and source code.There Following are the fews some steps to implement Publish Multi-Photo Stories.

  • Create a Facebook App
  • facebook developer app website to signup as a developer.
  • Fetch the API key and the app secret key.
  • Manage Facebook Login Into get the access token
  • using facebook developer tools
  • Make HTML Form to upload multiple photos.
  • follows other facebook api documentation

Upload Facebook using PHP SDK

Upload Stories Multi-Photo Photos to Facebook using PHP API SDK



Publish Multi-Photo Stories using Facebook with PHP



    
Post Multiple photos Stories via Facebook API

IT is the PHP source code for simple My Post uploading multiple photos with server side folder to the specified target directory.

The simple PHP libs uploaded multi-photo file your locations are sent to a simple core PHP methods which manage the devloper Facebook API To one by one photo upload and handle process by using latest version of the PHP SDK.This PHP source code for FBUserPhoto class main file that manage the two or more multi-photo upload on Facebook Stories.

function uploadPhoto($fbtargetPath)
{
    $fbuploadMultiIdArr = array();
    foreach($fbtargetPath as $imgURLmultiple) {
        $fbMultipleImg = array(
            "url" => "https://www.pakainfo.com/publishing-multi-photo-stories-to-facebook-using-php-sdk/" . $imgURLmultiple,
            "published" => false
        );
        try {
            $results = $this->fb->post("/{user-id}/photos", $fbMultipleImg, $this->accessToken);
            $multiPhotoId = $results->getDecodedBody();
            if(!empty($multiPhotoId["id"])) {
                $fbuploadMultiIdArr[] = $multiPhotoId["id"];
            }
        } catch (FacebookResponseException $e) {
            // showing error message
            //print $e->getMessage();
            exit();
        } catch (FacebookSDKException $e) {
            //print $e->getMessage();
            exit();
        }
    }
    return $fbuploadMultiIdArr;
}

Uploaded Multiple Photos Publish on Facebook Stories

Embed Multiple Photos and Publish Facebook Stories

function publishMultiPhotoStory($title, $fbuploadMultiIdArr)
{
        $fbMultipleImg = array( "message" => $title );
        foreach($fbuploadMultiIdArr as $k => $multiPhotoId) {
            $fbMultipleImg["attached_media"][$k] = '{"media_fbid":"' . $multiPhotoId . '"}';
        }
        try {
            $results = $this->fb->post("/{user-id}/feed", $fbMultipleImg, $this->accessToken);
        } catch (FacebookResponseException $e) {
            // showing error message
            print $e->getMessage();
            exit();
        } catch (FacebookSDKException $e) {
            print $e->getMessage();
            exit();
        }

}

This is the below Images with the our Facebook Stories output of public publishing two or More multiple differents photo story Like.

Publishing-Multi-Photo-Story-Output-on-Facebook
Publishing-Multi-Photo-Story-Output-on-Facebook

Download Source code

Publish Multi-Photo Stories using Facebook

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Publish a status with multiple images in a Facebook post.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment