dpvv37755 2014-04-18 20:45
浏览 33
已采纳

如何使用php SDK在一个域内托管Facebook(作为App)运行php代码? [关闭]

I have a Facebook page and I want to interact with my viewers using own PHP code. I want the page users to like my page before they can participate any activity posted in my page, such as poll.

Can anyone please guide me / point me how to use PHP Facebook SDK to communicate with my viewers of the page? Also please let me know how I can make them like my page before they participate.

Let me explain differently that I am looking for a definitive guide for Web site app and page tab app for Facebook using php Facebook SDK.

UPDATED based on reply from JCBiggar

Thanks for your answers. I'll separately figure it out how I can get the Facebook user details who is viewing my Tab App. I also need to resolve how can I make them like before they interact with my page. I really don't want anybody to use that page who doesn't like the page. But lastly I am only confused with respect to my availability of the tab to my viewers. I agree with all your assumptions that I am not looking for publishing my app to Facebook, as it is for my use only. But I want all my viewer to be able to see the Tab page link in my page. Right? That is the basic requirement. As you told that I need not to submit the same, and as I have already added to Tab to my page it will be available to all my viewer, I tested with a Hello World App but that is the not the case. I have added

the view of the page when visited from the other account than owner's account

https://drive.google.com/file/d/0B-ev9CQ281vyMndWX3NqTi14MGc/edit?usp=sharing

and also added

the view of the page when visited from the owner's account

https://drive.google.com/file/d/0B-ev9CQ281vydzltVzNuVEZralE/edit?usp=sharing

As you can see the Tab is only available only when viewed from Owner's account (from the account it was added + the owner of the page), but the same is not available from any other account. Can you please help me on this and I'll close this question.

I found that I cannot post image, so providing you link separately.

  • 写回答

2条回答 默认 最新

  • duanrou5680 2014-04-19 02:18
    关注

    There is a way to do this actually. Well if you are talking about having a "Tab" on your facebook page that has your website, or your php code on there. In order to do this, you will need to have an SSL, for since one of the most recent facebook updates, they require the code you display on their site to be secure.

    You will want to check on here for how to create a facebook canvas page. Here is a very good tutorial to do that:

    http://blog.hubspot.com/blog/tabid/6307/bid/26330/How-to-Create-Custom-Tabs-for-Facebook-Business-Pages.aspx

    I'm not sure if this is exactly what you were looking for, but if it is, I know this works, I used to run my whole website through a tab. Hope this helps!

    Oh, and not sure if they have to like your page in order to see it. I know a while back that used to be the case. But facebook has had so many updates, I dont know if they have removed that or not.

    Get started on your facebook here: developers.facebook.com/apps

    UPDATED

    You are creating a canvas app. Which can be added on facebook to other facebook pages. Not just yours. But big chances are, people arent going to add a random app that has nothing to do to your page on their page. But since you would like to have php content on your facebook page, this is the only way to do that. The polls app you sent me, the reason that requires people to like their page before they continue, is because the app is not on their page itself. When you create an app. It is given its own app url. So, I am guessing, if you really wanted to, you could add facebook code on your app that you are making, to require them to like your page before they submit, or something. Im not sure of the code to do this.

    Now to answer your questions:

    The tap app is availible when you add it to your page, any user that gets on your page can see it. And anyone whom your send your url too the app page, can add it to their page... you probably would want to do that anyways, since you just want your code on your page. You would only submit it to the facebook directory if you wanted people to find your app and add it to their pages. But I dont think this is what you are wanting to do.

    As far as the secure page. Sadly, the answer is yes, it has to be secure to even test it. I actually found out that facebook update the hard way, when I noticed all my code was just blank each time I was trying to test it. Then later found their update required a SSL Certificate for your page the content is pulling from.

    To answer you other questions:

    When you add a tab to your page. If someone clicks on the tab. It is still on your facebook page. Its almost like someone clicking on your page photos. It doesnt leave your page, if just show all your photos. The tab is basically the same thing.

    Sadly, facebook has remove the option to allow tabs to be the landing page when someone goes to your page. So there is no way Im sure, that I know of, to display the code on your facebook original page.

    Now with the adding the tab to your facebook page, let me explain it like this. You know the area where you enter your page tab URL and your secure page tab URL. Well look at that as, telling your app to pull from that page. Which basically displays that page in an iframe on the facebook tab. Now when you go to register. Remember how earlier I said, your page isnt listed in the facebook directory. When this is the way to actually get to your app page: http://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

    You are basically entering your UNIQUE APP ID... since many people can use the same URL for different apps, then at the end just page the same URL that you entered for your website field.

    This isnt a hack, but just the actually way to get to the page itself. Registering the app, is only if you want to let it show up in the facebook directory, which again, I dont think is something you are really wanting to do. That is mainly for big company's like, lets say, Instagram. I think they created an app, that is in the directory, that users can find and add to thier page, then enter certain information to allow their photos, and stuff to show up. But that is the premise for registering an app. So I wouldnt worry about that, unless the app you are making, you are trying to make for other pages to add for their page.

    As of which user is viewing your page tab. I do not know. As far as the coding of facebook apps. I'm not very familiar with. I only used the apps to display my website, and contact forms on facebook pages. It is possible that this displays on your facebook insights for your page. But I am not sure. I do hope this information will be helpful to you, and hope you can figure out what you are trying to do.

    UPDATE:

    So Im not sure why its not viewable for non-admin viewers... Im guessing there might have been another facebook update with that... but I did some research and found something that will solve all your problems.. I dont think you even need a SSL certificate with this:

    Watch this Youtube tutorial: http://www.youtube.com/watch?v=T3SWr5wTWsE

    And this is the app you can use that is in that tutorial: https://www.facebook.com/appcenter/static_html_plus

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!