Use the Facebook SDK to determine if visitors have pressed Sanuki and become members of the fan group _php tutorial

Source: Internet
Author: User
Tags api manual
There's a move in the company today, and one of the activities is to ask visitors to click on Facebook's Sanuki and Sanuki giveaway to send the gold. Facebook has been wall by everyone, and Baidu has discovered that because of the wall, the reason for the lack of Facebook in the country.

The Facebook API is simple enough to simply use an IFRAME to put the HTML code on it, but this time because it involves cash, I don't want to use curl to crawl the source codes, which is not true, plus there is rarely anything in the country about Facebook. Even if there is also a kind of news, I have a few technical articles is also a few years ago the old thing, now take the code to simply can't use, forced to eat a night of the English version of the API manual, said the manual to mention we look at the register when the most easy to find is https:// Developers.facebook.com/docs/reference/php, which provides a lot of internal methods for us to directly adjust the required content, but because it is a Facebook preset, the method provided does not satisfy very special needs ( Just like today I'm going to have a very special function, I finally found https://developers.facebook.com/docs/reference/fql/, which is mainly about Facebook's fql (this thing is very strong, As long as you can think of functions that can almost be realized, this example is due to the use of FQL to be resolved)

Before I drop the code, I'm going to start by simply mentioning that if you want to launch a Facebook program, you have to apply to his AppID and secret, and the method is simple from https://developers.facebook.com/apps/?action= Create application on the line, the space is no longer baggage (if you feel the difficulty can be in my QQ group 223494678 discussion). With these two things you still need to download the Facebook SDK, the download address is https://github.com/ FACEBOOK/FACEBOOK-PHP-SDK, download after the decompression, only take out the Src file folder is enough to use, can be deleted, the next side is the code, I have to add a line to explain

 =is_like (' 213202422194942 '([0]===' Already pressed Sanuki ' [1();bool Type, [has been pressed Sanuki true, reverse false] 1=>str type, when [0]=false hint content) Usage: $a =is_like (' 213202422194942 '); if ($a [0]===true] {echo ' has pressed Sanuki ';} else{echo $a [1];} /*Is_like ((()=='') { (, ' The ID of the fan group cannot be empty! ' (' src/facebook.php ' =Facebook (' AppId ' = ' Fill in the contents of your application ', ' secret ' + ' fill in the contents of your application ', ' cookies ', (!(( (, ' upload Facebook's API failure! ' =-(!) { =(, '->getloginurl ((' scope ' = ' publish_stream '). > Click to log In '{ =->api ((' method ' = ' fql.query ', ' query ' = ' SELECT page_id from Page_fan where page_id= '.. ' and uid= '..''(() and([0] [' page_id ']) and([0] [' page_id '])! =''=(,''
                                                                                              
                                                                                               = (, ' not yet pressed Sanuki! ') 
                                                                                                    
                                                                                                       (,, , 
                                                                                                            
                                                                                                              
                                                                                                                
                                                                                                                

Hope this article can play the role of dumping brick jade

P align= "left" > http://www.bkjia.com/phpjc/739852.html www.bkjia.com true http://www.bkjia.com/phpjc/739852.html techarticle Today the company is going to be active, and one of the activities is to ask visitors to click on the Sanuki of the Facebook fan group and Sanuki to send the gold after giveaway. Facebook was wall by everyone, in Baidu search ...

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