i am using this widget to get my users to create accounts:
<iframe src="http://www.facebook.com/plugins/registration.php?
client_id=113869198637480&
redirect_uri=http%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fecho%2F&
fields=name,birthday,gender,location,email"
scrolling="auto"
frameborder="no"
style="border:none"
allowTransparency="true"
width="100%"
height="310px">
</iframe>
but wen i click on the submit button i want to send the information to a link like :
http://www.xxx.com/Index.php?url=/leads/form&client_code=" Facebook"&name="XXX"&phone="XXXX"&email="test@XXX.com"
any ideas how to pass those vars to the redirect_uri ? I see that the response comes in json, so should i set some vars that grab the info from the json response and then pass them to the url?
any idea helps,
Thanks
edit.
the response that i get back is not complete for some reason:
i cant see the email, gender, etc
Array
(
[algorithm] => HMAC-SHA256
[expires] => 1313038800
[issued_at] => 1313033344
[oauth_token] => 103750869718158|2.AQAx-VOlqYgoM6yr.3600......
[user] => Array
(
[country] => us
[locale] => en_US
[age] => Array
(
[min] => 21
)
)
[user_id] => 100002389272431
)
edit:
to get the sign_request i use this script and i set my redirect_uri to my Canvas Page.
i have placed the registration form and the php in the same file.
the problem is that i dont get all the data that i place in the form
define('FACEBOOK_APP_ID', '113869....637480');
define('FACEBOOK_SECRET', '0f60d2c.........4f6f921c899');
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);
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
error_log('Unknown algorithm. Expected HMAC-SHA256');
return null;
}
// check sig
$expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
if ($sig !== $expected_sig) {
error_log('Bad Signed JSON signature!');
return null;
}
return $data;
}
function base64_url_decode($input) {
return base64_decode(strtr($input, '-_', '+/'));
}
if ($_REQUEST) {
echo '<p>signed_request contents:</p>';
$response = parse_signed_request($_REQUEST['signed_request'],
FACEBOOK_SECRET);
echo '<pre>';
print_r($response);
echo '</pre>';
} else {
echo '$_REQUEST is empty';
}
You first have to verify and decode the signed request before getting the JSON – there’s example PHP for this here. The place you should do this is in the script referenced in the redirect_uri – change:
to the appropriate URL of the script doing the verification, which should be on the same domain as your Facebook app.
Once you’ve verified and decoded in your redirect_uri script, you’ll have an associative array containing the relevant properties (and you’ll know that it was verified registration data). From there, you could json_encode this data again and POST it to the appropriate form (which is hopefully at a location your Privacy Policy makes very clear to users your app will be sharing data with).