Witicles Experts Online Articles Directory
Witicles Experts Articles Directory Witicles Experts Articles DirectoryWiticles Experts Articles DirectoryWiticles Experts Articles Directory

Welcome, Guest!     Sign Up    Sign In
Sponsored Ads

Become A Witicles.Com Expert Contributor Today

Who Kidnapped Excellence

Author Box

Free Online Articles EditorFree Online Articles Editor
We challenge the minds of people towards mental and attitudinal shift and National transformation. We are the Editorial team of Witicles.com & Witicles.com.ng. Promoting knowledge for all!
Joined 5 years ago
From Abuja, Nigeria
Total Articles 137

Recent Articles From Author

# How do I download or save a YouTube video to my computer?
# LeEco's first driverless car, 7 things to know about It
# How To Buy eBooks on Kpibooks.com.ng in Nigeria
# How to Write a High-Quality eBook in 30 Days

Namecheap.com Namecheap.com
Shop for Books online in Nigeria at kpiBooks.com.ng Order your favourite books online now, Save the stress & Pay online or with cash at Your Doorstep!

We help our esteemed clients develop web strategy that works!
Call us @ +234 803 578 3880

Authors Spotlight
Gboyega Adedeji  Gboyega Adedeji
Gboyega Adedeji is a Veteran Writer on Witicles.comVeteran Author
243 Articles
   Mentored By Jesus Christ | Writer | Inspiring Speaker | Publisher | Coach | Builder | CEO @ https:... from Abuja, Nigeria

Abiola Benjamin Obayomi  Abiola Benjamin Obayomi
Abiola Benjamin Obayomi is a Veteran Writer on Witicles.comVeteran Author
249 Articles
   Real Estate is my Profession. The change we need in Nigeria begins with all of us doing things differently. Collectively, we can make Nigeri... from Abuja, Nigeria

Free Online Articles Editor  Free Online Articles Editor
Free Online Articles Editor is a Veteran Writer on Witicles.comVeteran Author
137 Articles
   We challenge the minds of people towards mental and attitudinal shift and National transformation. We are the Editorial team of Witicles.... from Abuja, Nigeria

Omolara Adedeji  Omolara Adedeji
Omolara Adedeji is a Veteran Writer on Witicles.comVeteran Author
60 Articles
   I am a kingdom expander and I believe in the testimony of a transformed life as the greatest testimony of all. I am a voice of God for m... from Abuja, Nigeria

Sell Your Books online in Nigeria, Earn 80% from book sales

Top Articles
Top 10 Reasons for Nigeria's Undeveloped Economy
CONSAT: Nigeria DTH Cable Television That Challenges DsTV, MyTV, Startimes and Others
INSIGHTS On Tithes & Offerings from Brother Gbile Akanni
The Pyramid of Friendship: Secret of Effective Relationships
The Quick Fix for Nigeria's Underdevelopment and Unemployment

Recent Articles
The Immutability Of God's Promises
Public Education Valuable
Indian Education System
The Cause of Church Rivalry & Church Competition in Nigeria (Exposed)
The Three Dimensions of Experiencing Christ: In Him We Live, Move & Have Our Being

Recent Comments
Escorts in Delhi
How To Season And Grill Chicken
7 days ago Look through our range of fresh Vip Escorts Service In Delhi . We review and add new companion every day. Click on individual profiles to see Vip Escorts Service In Delhi: - http://www.saumyagiri.com

Ayodele Temidayo
The Blessedness Of Service: How God Rewards His Own
3 weeks ago Great piece sir. Soar in grace and God makes your oiverli soul fat in Jesus name

isha garg
Some Most Excellent Alternative to Buy Gifts for Valentine’s Day
3 weeks ago Hello I have found this article totally interesting have you seen it... http://www.dianaescorts.in/ http://www.hotdelhiescort.com/ http://www.dwarkaescortsgirls.com/ http://www.escortsservicesindelhi.com/ http://www.foreignescortsdelhi.com/ https://twitter.com/Callsgirldelhi https://www.ishagarg.in/

Site Clouds
Witicles, Articles, Webnigerians,Experts, Submit Articles, Become A Writer, Writing, Technology, Leadership, God, Government, Management, Nigeria, Society, Culture, Authentic Articles
Social Sharing

Sponsored Ads

Article Category >>>Traffic Generation

How To Automatically Post to a Facebook Page using PHP Facebook SDK

By Free Online Articles Editor       May 18, 2015

How To Automatically Post to a Facebook Page using PHP Facebook SDK

During my weekends/time off I tend to watch quite a lot of sport, with the English Premier League (EPL) being one of my favourite things to support. As such, I created and run an EPL facebook page dedicated  to covering fixtures, results, and other news.

Now this all good fun and I enjoy doing it, but week after week, month after month of posting all the fixtures the day before and posting the results the day after gets a little tedious, especially if I’m short on time. So being the geek I am, I decided that I could easily automate these, and so I did, using the PHP facebook SDK.

It was actually pretty straight forward, the hardest bit was trying to find websites which would give me the information in a straight forward and easy way. In the end, I decided to go with the offical Premier League website, as not only is it the correct information it is also laid out in a way which makes it easy to retrieve.

So putting my previous posts into good use I used curl to scrape the website and Xpath to dissect it into the important parts (namely the home and away teams, the location, and the final score).

Once I have this important information I can then go away and use the PHP facebook SDK to post a status to my EPL News feed which I will show you how to do now.

Firstly, you will need to create a facebook application which will be integrated in a website. After you’ve created the app you will want to fill out the website URL and hit save. This URL is going to be where the PHP app you are going to create will be stored (ie http://devhour.net/fbapp).

PHP facebook SDK - Facebook Application

EPLNewsFeed Facebook Application


Next up you’ll need to run the following URL to authorize your app to manage your pages and other such permissions. Remember to replace [APP_ID] and [SITE_URL] with both your facebook APP ID and the website you entered above. You will be prompted to grant access to your app (click Allow).


It will then redirect you back to the URL of the site you specified in the app. If you look closely though you’ll notice that on the end of the url is ?code=aBuNcHoFgIbBeRiSh. Copy everything after the ?code= and keep it in a safe place for now. You’re going to need it in a second.

The next step is to get the long lasting access token which will allow you to keep posting without having to authenticate yourself every time (this is vital to making this whole script automatic). So again go to the following URL and replace [APP_ID], [APP_SECRET], [SITE_URL], and [CODE] (the one you just previously copied).


If all went well you’ll be redirected back to your website and on the screen you should see:


Store this somewhere because it’s very important :)

Now the fun can start. Firstly, you can test the access token by going to the Facebook Graph API explorer, pasting the token into the Access token field and trying the following:

PHP facebook SDK - Graph API

Facebook Graph API Explorer

This will post a test message to your page which will indicate that the access token you have is good to go. Now on to the code…

Before we write any code on our end, you’re going to have to download the PHP facebook SDK from the github repo. Download and store these files somewhere handy and feel free to jump into the examples are have a bit of a play.

On our end however, the first thing we are going to is create a php file and reference the facebook sdk and enter some variable details (fill out as necessary).

Now we go ahead and create a new facebook instance using our newly created app details.

The next little piece of code will loop through the pages that you manage and find the PAGE_TOKEN which matches the PAGE_ID you specified. This will allow you to post to that pages wall as the page rather than you.

Taking all the information we have so far received we can now go ahead and post to the pages wall.

And that’s it. It’s actually really straight forward and easy to do. Feel free to play around with it and I’d be interested in seeing what you can come up with

From Witicles.Com: Thank you for the gift of your time. We appreciate you for reading this article published by Free Online Articles Editor. Witicles.Com is indeed your partner for your growth, effectiveness and maturity.


If you need to re-publish this ARTICLE, please cite this article - (http://witicles.com/how-to-automatically-post-a-page-using-php-facebook-sdk-359.html) and the Writer (Free Online Articles Editor)

Do You Find This Article Helpful?

Article Tags: how to post, automatically, facebook fan page, fan page, post to facebook, php sdk
Save the Stress, Shop for Books Online in Nigeria - kpiBooks.com.ng
Article Source
Free Online Articles EditorAbout Free Online Articles Editor
Free Online Articles Editor Free Online Articles EditorFree Online Articles EditorFree Online Articles EditorFree Online Articles Editor



Social Sharing
If You Enjoyed This Article; Then, Share It On Your Social Network

     Copy This Short Link To The Article: http://i.witicles.com/qCsLE How To Automatically Post to a Facebook Page using PHP Facebook SDKHow To Automatically Post to a Facebook Page using PHP Facebook SDKHow To Automatically Post to a Facebook Page using PHP Facebook SDKHow To Automatically Post to a Facebook Page using PHP Facebook SDK

Post Comment

Article Comments

No comment found! Be the first to share your thoughts on this article!

Related Articles

Author's Articles

" " " "

My Accounts Categories Useful Links Affiliate Links Follow Us
Witicles.com is not a mere article directory; but Trusted Online Article Directory of syndicated articles on 27 core topics, including health and fitness, finance, business and economy, life improvement, real estate, politics, leadership, management and education. Authors publish articles for free and share knowledge with potential customers.

My Accounts
Account details
Lost Password

News and Society (169)
Self Improvement (139)
Business and Economy (103)
Leadership (102)
Politics (68)
Arts & Entertainment (44)
Health & Fitness (126)
Religion and Kingdom (58)
Real Estate (16)
Computers & Technology (21)
About Us
Advertise With Us
Contact Us
How To Submit Articles
Article Writing Tips

Flickers of Hope Foundation

CentreNDL on Facebook  Facebook

CentreNDL on Twitter  Twitter

CentreNDL on Google+  Google+

CentreNDL Blog  Blog

Send Email to Hubpile  Email