Skip to main content

Posts

Showing posts with the label facebook

creating a facebook messaging system using php and facebook access tokens

Here is the procedure that was used to write posts in facebook by allowing the user to signin using their facebook id and then writing a post in their facebook profile page. 1. use the following url with your own application id created in facebook facebook login     Then after the page is reloading, get the access token returned by facebook for the logged in user     3. use the following lines of code to get the facebook access token from the set cookie above and use it to send the post data via curl to facebook if(isset($_COOKIE['access_token_fb'])) {     /* NEVER DELETE THIS LINE. THIS IS THE MOST IMPORTANT LINE IN USING FACEBOOK */     json_decode(file_get_contents('https://graph.facebook.com/me?access_token=' .$_COOKIE['access_token_fb']));         /* new testing code */         $url = "https://graph.facebook.com/me/feed";     $ch = curl_init();     $attachment =  array(   'access_token'  => $_COOKIE['access