Use PHP to post link to Facebook page every time I upload podcast
Can someone point me in the right direction? I see Stream.publish is being retired with the REST API, and would love to know what PHP I can put on the back end to make it so that every time a new podcast开发者_StackOverflow is uploaded, it will be posted to our podcast's Facebook page. Thanks.
You can use the graph to do this using the PHP api. An example is found here, under the publishing heading. The main thing is to ensure that you have the required parameters and that you use POST so that Facebook handles the request as a write.
As shanethehat pointed out, the Graph API is where you'll want to look. If you're an admin for the page, you can get an access token for your page by requesting the manage_pages permission detailed on the permissions page.
Once you have the access token, you can go ahead and POST to the page feed to create a new link.
Facebook just recently released a Graph API Explorer that you can use to try out different requests on the graph API without writing any code. You should also take a look at Facebook's PHP SDK. I don't use PHP, so I haven't used their SDK, but it should make what you're trying to do pretty easy.
(I'd post links to the Graph API Explorer and SDK, but SO won't let me yet.)
精彩评论