Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-15-07, 10:47 AM   #1
sytaylor
Cerebral Barbarian
 
sytaylor's Avatar
 
Join Date: Nov 2000
Location: Leeds, UK
Posts: 1,656
Default Facebook App development

Hey folks,

I'm looking into writing a few small facebook apps, basically for club promo type stuff. Im using MySQL and php. I installed the developer application fine, and I am attempting to run their Hello World sample code. Yet for some reason I cannot solve the error it throws me. It claims

Code:
Parse error: syntax error, unexpected '>' in .../facebooksytest/index.php on line 4
Does anyone have experience with Facebook app development and an idea what could be causing it?
__________________
Intel Core 2 Quad Pro Q6600 @ 3.42GHz | Abit IP35 Pro | GeIL 4GB DDR2
Gainward BLISS GeForce 8800 GTS 512MB 770/1920/1070
Creative Audigy 2ZS on Logitech Z-680s
Yuraku 24" Widescreen monitor

It saddens me that I need the following to post here:

Disclaimer: Any views expressed in the above post under the psuedonym "sytaylor" are entirely subjective and do not reflect the views of any business, company or entity associated with Simon Taylor. The use, copying of or editing of any materials within this post for professional purposes without written permission is stricly prohibitted under the UK Right of Privacy as provided in the Human Rights Act 1998 and the European Convention on Human Rights: Article 10 ECHR. Any attempt to use the information herin shall be subject to the Data Protection Act and Freedom of Information act, with damages being saught for defamation. This disclaimer applies to all text, images or media on this domain.

You have been warned.
My Blog
sytaylor is offline   Reply With Quote
Old 12-15-07, 11:21 PM   #2
ViN86
 
Join Date: Mar 2004
Posts: 15,486
Default Re: Facebook App development

Quote:
Originally Posted by sytaylor
Hey folks,

I'm looking into writing a few small facebook apps, basically for club promo type stuff. Im using MySQL and php. I installed the developer application fine, and I am attempting to run their Hello World sample code. Yet for some reason I cannot solve the error it throws me. It claims

Code:
Parse error: syntax error, unexpected '>' in .../facebooksytest/index.php on line 4
Does anyone have experience with Facebook app development and an idea what could be causing it?
hey sy,

can you post the code please?
ViN86 is offline   Reply With Quote
Old 12-16-07, 12:23 PM   #3
sytaylor
Cerebral Barbarian
 
sytaylor's Avatar
 
Join Date: Nov 2000
Location: Leeds, UK
Posts: 1,656
Default Re: Facebook App development

Sure

Code:
<?php
require_once 'appinclude.php';

echo '<p>hello $user</p>';
That basically just calls appinclude which does the linking to the facebook platform.

Code:
<?php
require_once 'facebook.php';

$appapikey = 'f501a8b28b9766cb836d90fe8bae708f';
$appsecret = '8b5e7680397dd4973c5d1d6991339a80';
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();

//[todo: change the following url to your callback url]
$appcallbackurl = 'http://www.themajesticself.com/facebooksytest/';

//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
  if (!$facebook->api_client->users_isAppAdded()) {
    $facebook->redirect($facebook->get_add_url());
  }
} catch (Exception $ex) {
  //this will clear cookies for your application and redirect them to a login prompt
  $facebook->set_user(null, null);
  $facebook->redirect($appcallbackurl);
}
When facebook.php is included in a download pack from facebook itself, to be installed on the webserver. Any ideas where my error is?
__________________
Intel Core 2 Quad Pro Q6600 @ 3.42GHz | Abit IP35 Pro | GeIL 4GB DDR2
Gainward BLISS GeForce 8800 GTS 512MB 770/1920/1070
Creative Audigy 2ZS on Logitech Z-680s
Yuraku 24" Widescreen monitor

It saddens me that I need the following to post here:

Disclaimer: Any views expressed in the above post under the psuedonym "sytaylor" are entirely subjective and do not reflect the views of any business, company or entity associated with Simon Taylor. The use, copying of or editing of any materials within this post for professional purposes without written permission is stricly prohibitted under the UK Right of Privacy as provided in the Human Rights Act 1998 and the European Convention on Human Rights: Article 10 ECHR. Any attempt to use the information herin shall be subject to the Data Protection Act and Freedom of Information act, with damages being saught for defamation. This disclaimer applies to all text, images or media on this domain.

You have been warned.
My Blog
sytaylor is offline   Reply With Quote
Old 12-16-07, 12:50 PM   #4
pross
 
pross's Avatar
 
Join Date: Mar 2007
Posts: 183
Default Re: Facebook App development

Code:
<?
require_once 'appinclude.php';

echo '<p>hello '.$user.'</p>';
?>
__________________
CPU: i7 2600k @ 4.4Ghz GPU: GTX 560ti 2G SLI PPU: GTX260 RAM: 16G Corsair Vengeance MOBO: P8Z68-V PRO GEN3 BOX: Cosmos S Cooling: Corsair H100 SSD: Corsair 120G ForceGT
pross is offline   Reply With Quote
Old 12-16-07, 04:26 PM   #5
ViN86
 
Join Date: Mar 2004
Posts: 15,486
Default Re: Facebook App development

yes, obvious question... but you remembered to close the <?php tag with ?>

right?
ViN86 is offline   Reply With Quote
Old 12-16-07, 06:37 PM   #6
ViN86
 
Join Date: Mar 2004
Posts: 15,486
Default Re: Facebook App development

i was writing code and i forgot a ?> tag and i got the same error.

it's due to the < symbol in the HTML and no ?> tag to close the php code.

so that's probably your problem.
ViN86 is offline   Reply With Quote
Old 12-24-07, 05:12 PM   #7
t3hl33td4rg0n
Dethklok Returns!
 
t3hl33td4rg0n's Avatar
 
Join Date: Dec 2004
Location: Kent, OH
Posts: 2,142
Send a message via AIM to t3hl33td4rg0n Send a message via MSN to t3hl33td4rg0n Send a message via Yahoo to t3hl33td4rg0n
Default Re: Facebook App development

Quote:
Originally Posted by pross
Code:
<?
require_once 'appinclude.php';

echo '<p>hello '.$user.'</p>';
?>
Yup, if your going to use single quotes, it wont process variables, escape strings (ie: \n or \t), and the like; so you have to concatenate the variable as pross has shown.

Code:
$baz = 'zzz';
$foo = ' bar '.$baz.' r00lz '."\n";
Outputs:
Code:
 bar zzz roolz
is also
Code:
$baz = "zzz";
$foo = " bar $baz roolz \n";
Outputs:
Code:
 bar zzz roolz
__________________


Intel QX9650 @ 3.83GHzXFX 780ieVGA GTX 560Ti8GB GSkill DDR800Creative Sound Blaster X-Fi Titanium PCI-ESeagate 1.5TB . 4x Samsung 2TB

Quote:
Originally Posted by MowTin View Post
....it's so clear how government makes things worse not better...
t3hl33td4rg0n is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook Nation: privacy changes go to a 270 million-user vote News Archived News Items 0 06-02-12 03:10 AM
Facebook Engineer Turns 5-Year-Olds Into Hackers News Archived News Items 0 05-23-12 08:00 AM
Report: Smartphones, Not Computers, Drive the Most Facebook Use News Archived News Items 0 05-08-12 07:10 AM
What's special about the Development Drivers? kugeleck NVIDIA Linux 2 05-04-12 03:31 PM

All times are GMT -5. The time now is 06:15 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.