Facebook share using PHP, Laravel 9 Example

How to share post in Facebook using PHP? – Sharing page to Facebook from a website using a link is simple as possible. In this post i will not use any types of the package or 3rd party tool or libs to Post the URL or message to Facebook. Facebook itself support to Post URL using the SDK or a simple URL Post, therefor in this post I will show you to Post page from your site to Facebook.

Facebook is most used social media app as well as I all want a button on our blog/website to Post the our product, article, services or contact to provider using Facebook. therefor in this post I will cover it in a easy method therefor it will not take much time to implement.

I can easily posting a a page to Facebook using below URL

Facebook share using PHP

https://www.facebook.com/postingr/postingr.php?u=https://pakainfo.com

You can use it in your html as below

Post to Facebook 

Step 1 : Make Laravel routes

Add appropriate routes to connect our URL to controller therefore open routes/web.php and add below routes


Here i created one route only that means you can make it anywhere but i am using it only our demo purpose.

Step 2 : Make Controller

Now, make the controller as i have mentioned in routes is ArticleController and also make three methods make, store and refreshCaptcha so make a file in app\Http\Controllers\ArticleController.php


Step 3 : Make view

I have make the controller and now i will make the view to show the button for sharing on social media





    
    
    Pakainfo Post/Send Message to WhatsApp in Laravel PHP 
    
    






    



Leave a Comment