Forum QuickConnect Php error while getting access token

Discussion and help relating to PlayerIO's QuickConnect feature, including Facebook Connect and Kongregate Connect.

Php error while getting access token

Postby samsonadze » January 7th, 2013, 12:54 am

I want to fb connect my game,and i want to get access token and send it to flash via flashvars,but when i do it,it's error,and i can't open php file,it's blank. heres my php code . please help :(

Code: Select all
<?php

require_once('facebook.php');

$facebook = new Facebook(array(
'appId'  => "315502538548303",
'secret' => "3fd8c5edc2eb11a26178132aab2*****",
'cookie' => true));
$access_token = $facebook->getAccessToken()
 
$session = $facebook->getSession();
$fbme = null;
if ($session) {
  try {
    $uid = $facebook->getUser();
    $fbme = $facebook->api('/me');
  }catch (FacebookApiException $e) {
   $uid = "";
     $fbme = null;
  }
}

if (!$fbme || !$uid) {

  $loginUrl = "https://www.facebook.com/dialog/oauth?client_id=315502538548303&redirect_uri=http://apps.facebook.com/flyndsmash/&scope=publish_stream";
         
}

if (isset($loginUrl)) {
   die('<script type="text/javascript">top.location.href="'.$loginUrl.'"</script>');
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=315502538548303";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Fly and Smash</title>

<style type="text/css">
body
{
   background-color: #FFFFFF;
   color: #000000;
}
</style>
<style type="text/css">
a
{
   color: #C8D7EB;
   text-decoration: underline;
}
a:visited
{
   color: #C8D7EB;
}
a:active
{
   color: #C8D7EB;
}
a:hover
{
   color: #376BAD;
   text-decoration: underline;
}
</style>
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="multitxt" align="middle">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="swliveconnect" value="true" />
  <param name="menu" value="false" />
  <param name="movie" value="main/fas.swf" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#ffffff" />
  <param name="FlashVars" value="var=<?php echo $var. $access_token ?>" />
  <embed src="main/fas.swf" quality="high" bgcolor="#ffffff" menu="false" width="100%" height="100%" name="multitxt" align="middle" allowscriptaccess="sameDomain" swliveconnect="true" FlashVars="var=<?php echo $var.echo $var. $access_token ?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


</object>
</div>
</body>


</html>
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Php error while getting access token

Postby Henrik » January 7th, 2013, 12:42 pm

Where are you hosting your PHP files?

And what error do you get?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Php error while getting access token

Postby samsonadze » January 7th, 2013, 5:22 pm

I'm hosting it on Free hosting "Heroku" . and i get Error -
Code: Select all
Server error
The website encountered an error while retrieving http://**************************************.com/fb/example.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
C#
samsonadze
 
Posts: 122
Joined: August 29th, 2012, 2:39 pm

Re: Php error while getting access token

Postby Henrik » January 7th, 2013, 10:13 pm

If you have problems with PHP on Heroku, you're probably better off asking their support for help...

But there's Facebook support in Player.IO SiteBox, have you looked at that?

http://playerio.com/documentation/sitebox/facebook
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to QuickConnect