| View previous topic :: View next topic |
| Author |
Message |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Thu Oct 20, 2016 10:49 am Post subject: http geturl bracket issue [solved] |
|
|
Hi everyone
i do face a small problem, where i need some help
| Code: |
set token [::http::geturl http://api.tvmaze.com/shows/$shownumber?embed[]=nextepisode&embed[]=previousepisode -timeout 4000]
|
when i open this url in my browser everything is fine, but the eggdrop seems to have a problem with those brackets. Because saving the output to file will result in outputting the previous episode only. Im guessing this has something to do with those []. Anyone has an idea how to solve that?
thanks for helping
Last edited by Elfriede on Thu Oct 20, 2016 3:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Thu Oct 20, 2016 12:00 pm Post subject: |
|
|
Use \[ and \] instead of [ and ] _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Thu Oct 20, 2016 12:36 pm Post subject: |
|
|
| when i try that i get: Illegal characters in URL path |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Thu Oct 20, 2016 12:55 pm Post subject: |
|
|
$ into \$
or just use set token [::http::geturl "http://api.tvmaze.com/shows/$shownumber?embed[]=nextepisode&embed[]=previousepisode" -timeout 4000] _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Thu Oct 20, 2016 1:02 pm Post subject: |
|
|
its not caused by the $
its [] but adding "" doesnt help either :/ |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Oct 20, 2016 2:12 pm Post subject: |
|
|
[] are used for command substitutions, and will cause issues with your code. Further, http URI's can't contain literal [], so you'll have to use %-substitutions; replace [ with %91, and ] with %93
Edit:
Accidentally wrote the decimal values as opposed to the hexadecimal ones;
"[" => "%5b"
"]" => "%5d"
That said, using ::http::formatQuery is indeed a better approach, as suggested by OP _________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Thu Oct 20, 2016 5:25 pm; edited 1 time in total |
|
| Back to top |
|
 |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Thu Oct 20, 2016 3:14 pm Post subject: |
|
|
| Code: |
http://api.tvmaze.com/shows/$shownumber?embed%91%93=nextepisode&embed%91%93=previousepisode
|
If i change like that; doesn't work :/
edit:
Thanks for all the help - could fix it by my own. If someone's interested:
| Code: | | set test "http://api.tvmaze.com/shows/$shownumber?[::http::formatQuery embed\[\] nextepisode embed\[\] previousepisode]" |
|
|
| Back to top |
|
 |
|