其他URL GET方法中的URL GET方法

时间:2016-04-15 10:49:44

标签: parameters get

我不知道这是否疯狂但我需要在同一个中发送2个GET请求。我的意思是,主要内部有一个GET。

http://zzz.com?url=http://yyy.com?y1=value&y2=value&z1=value&z2=value

问题来自于浏览器的假设。

需要的是:

zzz.com必须收到

url=http://yyy.com?y1=value&y2=value
z1=value
z2=value

由于

1 个答案:

答案 0 :(得分:0)

You can send a URL as part of a query string but you need to encode it first so the special characters don't get interpreted as part of the main URL.

For example, your inner URL

http://yyy.com?y1=value&y2=value

would be encoded as:

http%3A%2F%2Fyyy.com%Ffy1%3Dvalue%26y2%3Dvalue

and therefore your full GET URL would be:

http://zzz.com?url=http%3A%2F%2Fyyy.com%Ffy1%3Dvalue%26y2%3Dvalue&z1=value&z2=value

You would need to decode that first parameter back to it's plaintext equivalent on the server side before you could then use it as a GET URL.

How you do this encoding / decoding on the client and server side entirely depends on your technology stack.