简体   繁体   中英

blank page with Facebook PHP SDK

I have a strong problem with the Facebook PHP SDK. Here it is.

1) On my personal server this works fine:

$me = $facebook->getSignedRequest(); 
print_r($me);
$user = $facebook->api('/me');
print_r($user);

while on another remote server (a Windows one btw) it doesn't. If if comment the 2 last lines, it does, but the $facebook->api call breaks my script and I get a blank page.

2) This bug seems CURL related since at some point I got this screenshot: http://www.thomasaussenac.com/harleytest/screenshot.png

Anyway, I really can't get a way to solve it!


I still have the same error and sometimes I get such a message on a blank page:

Could not set cookie. Headers already sent. Invalid or no certificate authority found, using bundled information

But the fb_ca_chain_bundle.crt should be fine...

I don't understand at all, really...

Since the error message mentiones a cookie problem, try this:

$output = '';

$me = $facebook->getSignedRequest(); 
$output .= print_r( $me, TRUE ); 

$user = $facebook->api('/me'); 
$output .= print_r( $user, TRUE );

echo $output;

Why? Because $facebook->api('/me'); might try to set a cookie. Unfortunately, a PHP application can't set a cookie, if some output has already been sent to the browser.

Thus, it might be wise to save all output in a variable and finally send the variable's contents to the browser.

are you sure you are using correct API & Secret key. Check whether CURL is enabled in your apache server or not (by phpinfo())

Answer: I was using a server Windows without Apache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM