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
  • 86,532
  • 28
  • 194
  • 218
Chris Muench
  • 17,444
  • 70
  • 209
  • 362

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
  • 510,633
  • 85
  • 743
  • 889
1

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

urlencode vs rawurlencode?

Community
  • 1
  • 1
Zevi Sternlicht
  • 5,399
  • 19
  • 31