user131008
user131008

Reputation: 77

parse & as part of variable in php

I have this:

mysite.com/index.php?refferer=http://www.refferersite.com/index.php?var1=a&var2=b

this

http://www.refferersite.com/index.php?var1=a&var2=b

Will become this:

http://www.refferersite.com/index.php?var1=a

How can I fix this?

Upvotes: 0

Views: 45

Answers (2)

Sjoerd
Sjoerd

Reputation: 75588

Use urlencode on the url.

The link will then become:

mysite.com/index.php?refferer=http%3A%2F%2Fwww.refferersite.com%2Findex.php%3Fvar1%3Da%2a6var2%3Db

As you can see, the ampersands are escaped.

Upvotes: 1

Zathrus Writer
Zathrus Writer

Reputation: 4331

you will need to urlencode() your input

Upvotes: 3

Related Questions