Percent encoding and sql LIKE query
-
29-10-2019 - |
Pergunta
How do I send a get http request
which contains sql query with LIKE %item%
clause? I've read about percent-encoding, but don't know yet about how do I handle such a requests.
% sign
is handled upon percent-encoding
so it breaks sql query.
Help!
Solução
The % sign is encoded as %25
in URLs - is that what you are asking?
For example: http://www.google.com/?q=%25
Outras dicas
Just send the query portion in the query string part of the GET request. The % signs will be URL-encoded by the browser to send to the server, and PHP will urldecode them at the other end. The real question is WHY IN GOD'S NAME WOULD YOU DO SUCH A THING? It's terribly insecure and leaves you open to SQL injection attacks!
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow