Add an example of Facebook comment plugin on the PHP Site page tutorial, facebook example Tutorial _php tutorial

Source: Internet
Author: User
Tags in domain to domain

Add an example of Facebook comment plugin on the PHP Site page tutorial, facebook instance Tutorial


First, you need to create an app on Facebook, create a method see Https://developers.facebook.com/,APP There is one to fill in domain, here fill in your website domain. (app is bound to domain, can not be filled in)
Then you can use Facebook comments plugins.

With Facebook comments plugins, you can insert Facebook comments on your page.
Generate Code Method: Https://developers.facebook.com/docs/plugins/comments

For example, if you have a page that is http://www.example.com/, insert the following code in this page to use comments plugings.

 
     
 
   
 
  

appear on the page as follows

Total number of shares and comments read page

{Your_url} requires UrlEncode
Example: Https://graph.facebook.com/?ids=http%3A%2F%2Fwww.example.com%2F
Return:

{"   http://www.example.com/": {    "id": "http://www.example.com/",    "shares": 399517,    "comments": 392   

The code is as follows:

<?php $url = ' http://www.example.com/'; $api = ' https://graph.facebook.com/?ids= ';  $result = Json_decode (file_get_contents ($api. UrlEncode ($url)), true);  

Read page Comment List

{Your_url} requires UrlEncode
Example: Https://graph.facebook.com/comments/?ids=http%3A%2F%2Fwww.example.com%2F
Return:

{"http://www.example.com/": {"comments": {"Data": [{"id": "395320319544_27462154", "F Rom ": {" id ":" 100000223906701 "," name ":" Thu\u1eadn Phan Thanh "}," message ":" Hello mo To "," Can_remove ": false," Created_time ":" 2013-10-07t10:01:40+0000 "," Like_count ": 1," us Er_likes ": false}, {" id ":" 395320319544_27877980 "," from ": {" id ":" 100001638736612 "," name ":" L\u00e3 Minh "}," message ":" Hi You "," Can_remove ": false," created_t IME ":" 2013-11-13t02:57:01+0000 "," Like_count ": 4," User_likes ": false}, {" id ":" 395         320319544_27879381 "," from ": {" id ":" 100004229015145 "," name ":" Th\u00f9y Dung "}, "Message": "Mg \u1ee7ng h\u1ed9 t\u1edb v\u1edbi nh\u1edb \u003c3", "Can_remove": false, "created_time ":" 2013-11-13t05:38:12+0000 "," Like_count ": 3," User_likes ": false} ...]," paging ": {" Cursors ": { "After": "MjU0", "Before": "Mzk4"}, "Next": "Https://graph.facebook.com/v1.0/395320319544/com  Ments?limit=25&after=mju0 "}}}}

Request a comment on the next page according to the URL of next

The code is as follows:

<?php $url = ' http://www.example.com/'; $api = ' https://graph.facebook.com/comments/?ids= ';  $result = Json_decode (file_get_contents ($api. UrlEncode ($url)), true);  

Articles you may be interested in:

    • PHP functions for invoking comment templates and looping out comments in WordPress
    • Explain the PHP functions used to get Comment templates and search forms in WordPress
    • Write PHP script to realize the function of commenting paging in WordPress
    • Example of modifying a PHP script to make WordPress block spam comments
    • PHP with jquery implementation of comments top, stepping function
    • Ways to implement single-page comments using Angularjs and PHP laravel
    • How to use comment plugin on thinkphp
    • PHP implementation of the method of judging spam comments by the ratio of Chinese characters
    • PHP uses the STRSTR () function to block spam comments (by judging a tag)
    • Code to use Akismet to prevent spam comments in PHP

http://www.bkjia.com/PHPjc/1089946.html www.bkjia.com true http://www.bkjia.com/PHPjc/1089946.html techarticle Add an example of Facebook comment plugin on a PHP site page tutorial, the Facebook example tutorial first, you need to create an app on Facebook, create a method see https://developers.facebook.com/, ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.