Reputation: 49
Is it possible to crate SHARE link for specific page in my website? For instance:
http://www.MY-SITE.COM/index.php?page=show_book&book_id=$book_id
I tried:
<a title='Share on Facebook'
href='http://www.facebook.com/sharer.php?u=http://www.MY-SITE.COM/index.php?page=show_book&book_id=$book_id'
target='_blank'>
Share on Facebook
</a>
but it doesn't get the parameters.
Upvotes: 2
Views: 4230
Reputation: 15616
replace &
with %26
something like
$url = 'http://www.MY-SITE.COM/index.php?page=show_book%26book_id='.$book_id;
<a title="Share on Facebook"
href="http://www.facebook.com/sharer.php?u=<?=$url?>">Share on Facebook</a>
Upvotes: 0
Reputation: 2571
A common approach to this, which will work amongst other providers too (twitter, g+ etc) is to use a url shortening service like http://bit.ly.
Upvotes: 0
Reputation: 2220
looks like you need to echo
your $book_id
:
<a title='Share on Facebook'
href='http://www.facebook.com/sharer.php?u=http://www.MY-SITE.COM/index.php?page=show_book&book_id=<?php echo $book_id ?>'
target='_blank'>
Share on Facebook
</a>
Upvotes: 0
Reputation: 187
If the parameters are getting stripped, try url encoding them (rawurlencode() in PHP).
Also make sure your target share page is serving up different open graph meta tags based on the parameters.
Upvotes: 2
Reputation: 33439
Share button is old. FB recommends to use the like-Button
http://developers.facebook.com/docs/reference/plugins/like/
Upvotes: 1