Facebook link not well formatted
Closed this issue · 3 comments
Hi,
I am trying to use your package in order to create a Facebook share button, but it seems that the link is not well formatted. Perhaps Facebook changed some of the previous functionalities. I tried with other services, like twitter, and it works fine. Could you take a look and see if there is a quick solution for this issue?
Best regards!
I will gladly help you if you give me the URL that you are trying to share.
On 9 May 2016 at 17:11, Web Pixels notifications@github.com wrote:
Hi,
I am trying to use your package in order to create a Facebook share
button, but it seems that the link is not well formatted. Perhaps Facebook
changed some of the previous functionalities. I tried with other services,
like twitter, and it works fine. Could you take a look and see if there is
a quick solution for this issue?Best regards!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#10
Thanks for your quick reply :)
This is in my controller:
$share_link = Share::load('http://'.env('WEBSITE_URL').'/members/'.$user->id)->facebook();
This is the resulted string:
https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fhttp%3A%2F%2Fwpx-site.dev%2Fmembers%2F1125
As I said in my previous message, it works fine with Twitter. But not with Facebook. Facebook redirected to this URL:
https://www.facebook.com/dialog/return/close?error_code=100&error_message=href+is+not+properly+formatted#_=_
No error message given, but as I see it is a problem with the URL format.
`error_message=href+is+not+properly+formatted#=``
Do you have any idea why?
Thanks for your time! :)
Notice that http appears twice in the u variable. I think you will find that env('WEBSITE_URL') already includes http://, change your call to:
$share_link = Share::load(env('WEBSITE_URL').'/members/'.$user->id)->facebook();