Search code examples
phpfacebookfacebook-sharer

Facebook sharer URL getting cut off


I have the below link on my site and I want to share my page with the php value included. Facebook is cutting everything off after xxxxx.com? Any ideas why?

<a  data-role="button" class="facebook" 
   href="http://www.facebook.com/sharer.php?u=http://xxxx.com/eventview.php?eventid=
   <?php echo $_GET['eventid']?>"  title="Share this xxxx Event on Facebook" ></a></li>

Solution

  • First a comment: The sharer.php endpoint has been deprecated for a while now. I would not develop a new site using this. You should be using the Feed dialog instead.

    For the problem with the stuff getting cut off, do you have an og:url tag on the page that shows just xxxxx.com? If so, this is your canonical url for the page. Facebook will treat every page as copies of this one. You need to have the full path that you show above referenced as the page's canonical url. You will see this if you check the page in the debugger.