fbpx Facebook share links - controlling the data sent | ComputerMinds Skip to main content

Facebook share links - controlling the data sent

22nd Apr 2011

Mike Dixon

Senior Mind

Not strictly a Drupal post this, but something that I was playing with yesterday that I was really struggling to find any documentation on. We wanted a simple "share" on facebook link, we didn't want to go through the process of creating an app and using the opengraph API - instead we just want to use the simple sharer.php script but have a bit of control over what is being shared.

The basic approach is you are providing a link to http://www.facebook.com/sharer.php?s=100 which is the basic share page (typically this is shown in a popup).

By adding querystring params we can set a title, link and summary on the shared post - like so

&p[title] = Mike loves ComputerMinds
&p[url] = http://www.computerminds.co.uk
&p[summary] = Mike really really loves ComputerMinds

The final point is that those values MUST be URL encoded - just using the url_encode will do the job - which would leave something like this


Which we can then turn into a nice link - Share on FaceBook