0
Отвечен

HTTP GET special characters

josvanstiphout 10 лет назад в iRidium Script / AV and Driver scripts обновлен Oksana (expert) 10 лет назад 4
Hello


I need to send with HTTP GET: "/axis-cgi/io/virtualinput.cgi?action=6:/"


The ":" is not accepted as a character.
So it is sending "/axis-cgi/io/virtualinput.cgi?action=6%3A/" i.s.o. "/axis-cgi/io/virtualinput.cgi?action=6./"


How can I solve this?
please help!


Kind regards,
Jos van Stiphout
Hi Jos,

Can you provide more details regarding this project?  Are you just creating a TCP or HTTP driver and placing that in the project?  Or are you creating a driver with iRidium script?

The most immediate solution for yourself would be to use a script to replace the : with the url encoded equivalent.

the url is stored in a string and then use the .replace method to change the string.

var mystring = "test:"
var myencodedstring = mystring.replace(/:/g, "%3A");



Thanks,


Roger.
Hi Roger,


Thanks for your advice.
This morning I could not get it to work; I used wireshark to see to difference in de webbrowser and the iRidum HTTP GET.
Although %3A is equal to :, it did not work.
This afternoon I had to reset the camera, and now it works! :)
I don't know why it did not work before.
I did try to send a string with scripting, but I din't know how to use a string in this particular HTTP GET function.
I have added my test project, perhaps you can have a look and show me how to send a string when I need this in the future.


Thanks again.


Regards,
Jos
HTTPGET.irpz
Hi Jos,

Given that you are using the HTTP driver your send command should look like,

IR.GetDevice("Axis").Send(['GET,'+myencodedstring+',']);

So what this does is combine 'GET,'  string with the variable myencodedstring and the ',' character.

The comma at the end is needed by the HTTP driver to signify the end of the requested url.


Thanks,


Roger

Сервис поддержки клиентов работает на платформе UserEcho