1

If I am using a GET parameter in a web service call, what type of escaping should I do? I was thinking of just using htmlentities.

Example: http://example.com/search.php?search=1234

Search.php

Uses $_GET['search'] to make a web service call to another service.

CharlesB
  • 80,832
  • 27
  • 184
  • 208
Chris Muench
  • 17,552
  • 67
  • 200
  • 345

2 Answers2

6

In the URL, urlencode data.

HTML entities are only relevant in an HTML context.
Perhaps The Great Escapism (Or: What You Need To Know To Work With Text Within Text) can clear up that confusion.

deceze
  • 491,798
  • 79
  • 706
  • 853
1

Just adding to @deceze answer, it might be a better times to use rawurlencode.

urlencode vs rawurlencode?

Community
  • 1
  • 1
Zevi Sternlicht
  • 5,349
  • 16
  • 31