[OpenSIPS-Users] How to encode HTTP URL params values?

Liviu Chircu liviu at opensips.org
Wed Sep 16 10:47:16 CEST 2015

Hi Andrey,

You can place the unescaped string into a variable (e.g. "$var"), then 
use the {s.escape.user} transformation.
     $var(query) = "username=john smith&password=hard,to#guess";
     xlog("after: \"$(var(query){s.escape.user})\"\n");

     rest_get("http://localhost/?$(var(query){s.escape.user})", ...);

after: "username=john%20smith&password=hard,to%23guess"

Best regards,

Liviu Chircu
OpenSIPS Developer

On 15.09.2015 23:41, Andrey Vorobiev wrote:
> Hi,
> I try to use REST_CLIENT (OpenSIPS version 1.11) module in order 
> perform HTTP GET request with params in URL query part. Some of 
> parameters may contain space characters and need to be encoded 
> according to http://www.w3schools.com/tags/ref_urlencode.asp. It seems 
> that REST_CLIENT module doesn't encode specified URL. So what function 
> or script transformation should I use in order to encode HTTP query 
> params values?
> -- 
> Best regards.
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150916/fbef6d85/attachment.htm>

More information about the Users mailing list