Possible Duplicate:
Headers already sent by PHP
I have the following code in my php file. I want to redirect from this page using header function which is clear in code below. I have made sure that there are no echo commands and have also placed ob_start(); at the beginning of the file yet i am getting the following error:
Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web054/b548/ipg.psdingcampsduscom/facebook_registration_plugin/store_user_data.php:1) in /hermes/bosweb/web054/b548/ipg.psdingcampsduscom/facebook_registration_plugin/store_user_data.php on line 171
here is the code :
<?php ob_start();
define('FACEBOOK_APP_ID', 'xxxxxxxx');
define('FACEBOOK_SECRET', 'xxxxxxxxxx');
// No need to change function body
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) {
$response = parse_signed_request($_REQUEST['signed_request'],
FACEBOOK_SECRET);
header("location: fbwe/step2.php?name=".$name."&email=".$email."&gender=".$gender."&arts=".$cb1."&act=".$cb2."&cooking=".$cb3."&dance=".$cb4."&designing=".$cb5."&fashion=".$cb6."&interior=".$cb7."&modeling=".$cb8."&photography=".$cb9."&poetry=".$cb10."&programming=".$cb11."&reading=".$cb12."&sketching=".$cb13."&singing=".$cb14."&sports=".$cb15."&stunting=".$cb16."&videography=".$cb17."&other=".$cb18);
// Connecting to Database
} else {
//echo '$_REQUEST is empty';
}
?>
Can anyone figure out what is wrong?