3

I am developing facebook/myspace content share buttons. The Facebook link takes you to a URL on my website, but I need to pass additional parameters to my URL along with the parameters passed to facebook. Here's my example:

http://www.facebook.com/share.php?t=MyCompany&u=http://foobar.com/test7.php?Share=161&FbShare=Facebook28

Do I need to escape something inside the "u" parameter?

2 Answers 2

8

You should be able to do (http://php.net/manual/en/function.urlencode.php).

$url = 'http://www.facebook.com/share.php?t=MyCompany&u='.urlencode('http://foobar.com/test7.php?Share=161&FbShare=Facebook28');
Sign up to request clarification or add additional context in comments.

1 Comment

Perhaps I worry that I'll get it wrong and have to explain myself :)
2

You need to use urlencode on the u parameter, which will result in your URL looking like this:

http://www.facebook.com/share.php?t=MyCompany&u=http%3A%2F%2Ffoobar.com%2Ftest7.php%3FShare%3D161%26FbShare%3DFacebook28

1 Comment

How would I decode this on foobar.com/test7.php? Can I do regular GET_['variable' ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.