Sourav Sourav - 5 months ago 67
PHP Question

Invite friends to an application - Facebook

Previously my this code worked well but now it do nothing

I want to show an dialog then the user will be able to select some friends and invite them to use this application.

Now this code shows blank page.

<?php
include_once "fbmain.php";
if (isset($_REQUEST['ids'])){
echo "Invitation Sent";
$string = "<script type='text/javascript'>top.location.href='{$fbconfig['appBaseUrl']}';</script>";
echo $string;
}
else {
?>
<fb:serverFbml style="width: 500px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action="<?=$fbconfig['baseUrl']?>/invite.php"
target="_top"
method="POST"
invite="true"
type= <?php echo $fbconfig['appname']; ?>
content="I tried this and love this, what about you ? <fb:req-choice url='<?php echo $fbconfig['appBaseUrl']; ?>' label='Accept' />"
>

<fb:multi-friend-selector
showborder="false"
actiontext=<?php echo $fbconfig['appname' ]; ?>>
</fb:request-form>
</fb:fbml>
</script>




Answer

Now to invite friends the only way is to use FB JS the code

function showInvite()
{
<?php
if (strlen($fbconfig['appname' ])>50)
{
 $title = substr($fbconfig['appname' ],0,45);
 $title = $title . ' ...';
}
else
 $title = $fbconfig['appname' ];

if (strlen($fbconfig['appBaseUrl'])>200)
{
 $message = substr($fbconfig['appBaseUrl'],0,200);
 $message = 'I just love this App, now it\'s your turn to try it @ '.$message;
}
else
 $message ='I just love this App, now it"s your turn to try it @ '.$fbconfig['appBaseUrl'];
?>
 var r = FB.ui({ 
            method : 'apprequests',
            message: '<?php echo $message; ?>',
            title: '<?php echo $title; ?>',
           });
}
Comments