S
S
StrangeAttractor2014-12-18 17:15:50
Computer networks
StrangeAttractor, 2014-12-18 17:15:50

What is the correct way to encode the URL to be passed as a GET request field?

We need to write a couple of functions to unambiguously encode and decode any URLs (web addresses) to a forum (and vice versa) in which they can be made the value of a parameter of a valid other URL for a GET request. Please tell me the logic of such a function - what should be replaced with what, what should not be replaced with anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Benkovsky, 2014-12-18
@benbor

As far as I understand you, encode the collected url that you want to use as a parameter as another parameter. PHP example

$paramURL="http://my.site/?q=%20test%20"
$targetURL ="http://my.site/?back_url=" . urlencode($paramURL);

UPD:
Yeah, there is such an opinion that everything we want has already been written before us.
js: bit.ly/1wPspsI
c#: bit.ly/1wPsi04
Here, and if you really want to know how it works, then You need to read the specification: bit.ly/1wPsHQq

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question