在变量之后抓取所有文本

I'm a little unsure of how to word this one but essentially, I want to achieve the following:

http://my.website/?url=http://another.website/?var1=data&var2=moredata&id=119

And for the URL variable to be: http://another.website/?var1=data&var2=moredata&id=119

Naturally, PHP sees var2 and id as new variables. This would be used to pass a full URL from one page to another, however, it poses an issue when the page already has its own variables in the URL!

Any help appreciated!

You need to encode the secondary url which you're putting inside the url variable when you create it. This will ensure it doesn't contain special querystring characters that the receiving website will misunderstand. If the code in my.website is PHP too then the urlencode function (http://php.net/manual/en/function.urlencode.php) is your friend. For example:

urlencode("http://another.website/?var1=data&var2=moredata&id=119")

produces

http%3A%2F%2Fanother.website%2F%3Fvar1%3Ddata%26var2%3Dmoredata%26id%3D119

which will not be misunderstood by the PHP code reading it as containing further separate variables.