Peeran Ameer
Peeran Ameer

Reputation: 1

how to put the total score for quiz application to share by facebook?

I have a program which is quiz question for Facebook and I have the total score and I have the share part, how can I put the total score for this application to be shared when they click on share button. and that is the variable for total score:

 if(!strcmp($array1[$z],$array2[$z])) {
     $totalCorrect=$totalCorrect+20;
 }

This is my script for sharing:

<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_US/sdk.js#xfbml=1&version=v2.3&appId=1006983675986171";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>

Upvotes: 0

Views: 444

Answers (1)

andyrandy
andyrandy

Reputation: 74004

The code you presented is just for including the JS SDK, there is no code for sharing. Anyway, the Facebook docs offer a broad section about sharing: https://developers.facebook.com/docs/sharing/web

Instead of sharing, you could also use the Scores API: https://developers.facebook.com/docs/games/scores

...or you could use the feed endpoint: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed#publish

Upvotes: 1

Related Questions