php - Share quiz results on Facebook -


i have spent hours researching seems tricky many developers out there. have small php quiz, outputting results form in following way:

if (maxa) {    echo '    <img src="imgs/result4.jpg"/>    <div class="results2">    <p class="title">you bean</p>    <p class="details">description</p>    </div>'; } 

the question is, how add share button @ bottom of this, share result on facebook, description , picture. note there 4 available results.

i have made public app, , inserted following in head:

<script> window.fbasyncinit = function() { fb.init({   appid      : '1382290368762081',   xfbml      : true,   version    : 'v2.3' }); };  (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";  fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> 

and html yet figured out. went , forth answer: using "share_open_graph" facebook ui create dynamic share dialog quiz results - did not achieve anything.i think helpful whole community, if knows exact way make happen, , share them us.

you can use facebook js sdk this. can call fb.ui method feed achieve this. create button on page

<input type="button" onclick="posttofeed()" value="share" /> 

.use below function javscript share on facebook.

function posttofeed() {     // calling api ...     var obj = {       method: 'feed',       link: 'https://www.azeezkallayi.com/',       description: "description goes here",       picture: 'https://www.azeezkallayi.com/demo/test/womens-day.jpg',       name: 'international womens day'            };      fb.ui(obj);    } 

here can change values of parameters want.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -