开发者

blank page with Facebook PHP SDK

开发者 https://www.devze.com 2023-03-08 02:15 出处:网络
I have a strong problem with the Facebook PHP SDK. Here it is. 1) On my personal server this works fine:

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.p开发者_运维问答ng

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号