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

Create Free Website or Blog with Hubpile

Strategic Living: A Life Guide for Effective Living (eBook)






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 4 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



Become A Witicles.Com Expert Contributor Today



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
238 Articles
   I am a Nigerian and an Ambassador of Christ sent to Nigeria for the cause of His Kingdom. By divine-making, I read, teach and ... 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


Abiola Benjamin Obayomi  Abiola Benjamin Obayomi
Abiola Benjamin Obayomi is a Veteran Writer on Witicles.comVeteran Author
234 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 Ile-Ife, Osun State


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
Ghaziabad Call Girls Hi Fi Female Company Escorts in Ghaziabad
Choose Your Desire Kolkata Escorts Girls - Kolkata Escorts Service
Leah Sharibu: The Tragedy of Kidnap And Faith Not Renounced
Simple Troubleshooting Guide For The Issues Faced During The Booking Of Swiss Airline Tickets
Mahipalpur Escorts Link For The Entertainment


Recent Comments
ANU Sri
Trending Indian Georgette Saree, Silk Sari and Pure Chiffon Sarees
3 days ago Enjoy the latest collections of the traditional Kanchipuram Silk Sarees from the best traditional dress makers in the country. https://tulsisilks.co.in/saree/kanjivaram-silk-sarees.html

Vineet
Ghaziabad Call Girls Hi Fi Female Company Escorts in Ghaziabad
2 weeks ago Call me on 8587818940

Nisha
LeEco's first driverless car, 7 things to know about It
1 month ago I read this post your post so nice and very informative post thanks for sharing this post keep it up. http://www.angelss.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


Namecheap.com
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).

https://graph.facebook.com/oauth/authorize?client_id=[APP_ID]&scope=offline_access,publish_stream,manage_pages&redirect_uri=[SITE_URL]

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).

https://graph.facebook.com/oauth/access_token?client_id=[APP_ID]&redirect_uri=[SITE_URL]&client_secret=[APP_SECRET]&code=[CODE]

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

access_token=…….

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.

1461 Views


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

  

http://www.devhour.net/automatically-post-page-using-php-facebook-sdk/





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!



Namecheap.com
Related Articles




Author's Articles

" " " "




Related Books







Home | Advertise With Us | About Us | Contact Us | How To Submit Articles | Article Writing Tips | Webnigerians.com | kpiBooks.Com | Our Sitemap: XML HTML

Copyright © 2013-2018 Witicles. All rights reserved.