Home » » Facebook Registration Plugin with XFBML

Facebook Registration Plugin with XFBML

Written By 1 on Sunday, September 15, 2013 | 4:32 AM

Use the Following code for Quick Facebook Registration Integration.

/** PLEASE ADD YOUR APP_ID AND FACEBOOK_SECRET KEY FROM DEVELOPER PAGE **/
define('APP_ID','13869198637480');
define('FACEBOOK_SECRET','xxxxxxxxxxxxxxxxxxxxxxxxx');


/** print_r short function **/
function pr($data,$msg=null){
echo "
";
print_r($data);
echo "
"; if($msg){ die($msg); } } /** print_r short function **/ function base64_url_decode($input) { return base64_decode(strtr($input, '-_', '+/')); } function parse_signed_request($signed_request,$secret) { list($encoded_sig, $payload) = explode('.', $signed_request, 2); // decode the data $sig = base64_url_decode($encoded_sig); $data = json_decode(base64_url_decode($payload), true); // confirm the signature $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true); if ($sig !== $expected_sig) { error_log('Bad Signed JSON signature!'); return null; } return $data; } if(!empty($_POST)){ $requestData =$_POST['signed_request']; $response = parse_signed_request ( $requestData, FACEBOOK_SECRET ); echo '

Following are the Registration Detail

'; pr($response['registration'],' '); } $url='http://127.0.0.1/facebook/registration.php'; $fields= "[ {'name':'name'}, {'name':'email'}, {'name':'location'}, {'name':'gender'}, {'name':'birthday'}, {'name':'password'}, {'name':'like', 'description':'Do you like this plugin?', 'type':'checkbox', 'default':'checked'}, {'name':'phone', 'description':'Phone Number', 'type':'text'}, {'name':'anniversary','description':'Anniversary', 'type':'date'}, {'name':'captain', 'description':'Best Known Language', 'type':'select', 'options':{'hindi':'Hindi','english':'English'}}, {'name':'live', 'description':'Best Place to Live', 'type':'typeahead', 'categories':['city','country','state_province']}, {'name':'captcha'} ]"; $clientId=APP_ID;
[script src="https://connect.facebook.net/en_US/all.js#appId=&xfbml=1"][/script]
Any Issue? Read http://php-tutorial-php.blogspot.in/2013/09/Facebook-Registration-Plugin-with-Custom-Fields.html

0 Comment:

Post a Comment