Friday 15 May 2015

How to make a personal facebook app -


I'm trying to create a Facebook application that will have to do something on my timeline. I can not understand why I am not sure how things work, so I am hoping that some things can explain here. I do not want anyone to be installing that app or somehow to reprimand him for posting on my timeline in my name. If possible, what steps should I take to stop these things?

Besides, what you have learned so far, you use php-sdk to authenticate And then check the User ID for visitors.
"I will edit the code as we find out what you are trying to do, according to the action."

php sdk example.
  // init php sdk here // Check that we have the User // Call API to get information about that usage $ user_profile = $ facebook- & gt; API ('/ m'); // If we have a user, then we can use that User ID as a cover to filter the content. If ($ user_profile [id] === '000000000') {// 000000000 This is your Facebook ID for example. // I'm logged in, and only I can see it. // Get some information, post something, add photos and more; here. }   

curl example

When you curl 'me', it ensures that this current session is user, then when you get it from its real user id If you compare, you can use the gate "to talk so much" which only you can see and use me hard to make the connection is only necessary to make the gate, you call all your other curl You can know when you Are doing this.

  http://anotherfeed.com/curl.api.php? Objid = me   

Here's an example, when I curl me, it looks for the user to log in, if there is an access token for this example I will exclude , it will return an array with my ID along with my "my" information

hard coded I use $ me = $ curlresults [id] Which will bring my user ID back to the session call.

/ P>

  $ me = $ curlresults [id] if ($ me === 'myfacebookuserid') {// do my other curl calls here, I know that I can only see this. }   

Full curl example.
  1. Obtain your user token for your app from the token tool provided below, archive it from anywhere so that you can pass it through the URL ultimate or ultimate session ....
  2. Add your Facebook user id where it says myfacebookuserid
  3. To secure it, you must have access to a post, receive or token with the session.
  4. For this example we will use the method.

    yourpage.php? User_token = youruseraccesstoken How it is passed in this example.


      $ access_token = $ _GET ['user_token']; $ Build = 'https://graph.facebook.com/me?'.$access_token.' '; Function GetCH ($ url) {$ ch = null; If (! $ CH) {$ ch = curl_init (); } Curl_setopt ($ ch, CURLOPT_URL, "". $ Url. ""); Curl_setopt ($ CH, CURLOPT_HEADER, 0); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ ch, CURLOPT_FORBID_REUSE, true); Curl_setopt ($ CH, CURLOPT_FRESH_CONNECT, true); Curl_setopt ($ CH, CURLOPT_CONNECTTIMEOUT, 10); Curl_setopt ($ ch, CURLOPT_TIMEOUT, 20); Curl_setopt ($ CH, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); Curl_setopt ($ CH, CURLOPT_HTTPAUTH, CURLAUTH_ANY); Curl_setopt ($ CH, CURLOPT_SSL_VERIFYPEER, incorrect); $ Return = curl_exec ($ ch); If (! Curl_errno ($ ch)) {return $ return; } And {$ fb_fail = curl_error ($ ch); Refund $ fb_fail; } Curl_close ($ ch); Not set ($ ch); }; $ Returned = getch ($ build); $ Locs = json_decode ($ back, true); $ Meid = $ locs [id]; If ($ meid === 'myfacebookuserid') {// do my other curl calls here, I know that I can only see it}    

No comments:

Post a Comment