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

Andrey Vorobiev andrey.o.vorobiev at gmail.com
Wed Sep 16 11:44:57 CEST 2015


Great thanks.

On Wed, Sep 16, 2015 at 11:47 AM, Liviu Chircu <liviu at opensips.org> wrote:

> Hi Andrey,
>
> You can place the unescaped string into a variable (e.g. "$var"), then use
> the {s.escape.user} transformation.
> e.g.:
>     $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})"
> <http://localhost/?$(var(query)%7Bs.escape.user%7D)>, ...);
>
>
> (output)
> after: "username=john%20smith&password=hard,to%23guess"
>
> Best regards,
>
> Liviu Chircu
> OpenSIPS Developerhttp://www.opensips-solutions.com
>
> 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 listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


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


More information about the Users mailing list