Trying to share a Post on Facebook twitter LinkedIn on third parties account unable to post or share using Laravel
Trying to share a Post on Facebook twitter LinkedIn on third parties account unable to post or share using Laravel
I am trying to upload an image and share on all social media of third party. So how to share my post on the third party account using the Laravel. As i am new to this field so please help me. I don't know how to do it.
This is for Facebook what i have created to share the details.
.env File
FACEBOOK_ID=1xxxxxx2
FACEBOOK_SECRET=9xxxxxxxxxxxxx8
FACEBOOK_URL=http://localhost:8000/login/facebook/callback
config/service.php file
'facebook_poster' => [
'app_id' => getenv('FACEBOOK_APP_ID'),
'app_secret' => getenv('FACEBOOK_APP_SECRET'),
'access_token' => getenv('FACEBOOK_ACCESS_TOKEN'),
'redirect' => 'http://localhost:8000/login/facebook/callback',
],
uploadfilecontroller
This is my controller to upload image and share on facebook.
function upload(Request $request)
{
$this->validate($request,[
'select_file' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048'
]);
// dd('done');
$image = $request->file('select_file');
$new_name = rand() . '.' . $image->getClientOriginalExtension();
$image->move(public_path("images"), $new_name);
SendTo::Facebook(
'photo',
[
'photo' => public_path('images/'.$new_name),
//Test this and we will up date the discription
'message' => 'The discription goes here !!'
]
);
return back()->with('success','Image Uploaded Successfully')
->with('path', $new_name);
$user = new file;
$user->name = $file->getClientOriginalName();
$user->save();
return 'data saved in database.';
}
view as upload.blade.php
This is my view file to dispaly share button of facebook.
<form method="post" action="{{ url('/uploadfile')}}" enctype="multipart/form-data">
{{ csrf_field() }}
</div>
</form>
Is it fine now..? @C2486
– Amruta
Jun 22 at 15:34
No, it's not OK, there is edit history. You should delete the question
– Braca
Jun 23 at 1:51
should I delete and repost the question ..?@Braca
– Amruta
Jun 23 at 9:30
s please repost it @Braca
– Amruta
Jun 26 at 6:53
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
you jut post the credentials here
– C2486
Jun 22 at 13:18