egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

http geturl bracket issue [solved]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Elfriede
Halfop


Joined: 07 Aug 2007
Posts: 67

PostPosted: Thu Oct 20, 2016 10:49 am    Post subject: http geturl bracket issue [solved] Reply with quote

Hi everyone Smile

i do face a small problem, where i need some help Smile

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Thu Oct 20, 2016 12:00 pm    Post subject: Reply with quote

Use \[ and \] instead of [ and ]
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Elfriede
Halfop


Joined: 07 Aug 2007
Posts: 67

PostPosted: Thu Oct 20, 2016 12:36 pm    Post subject: Reply with quote

when i try that i get: Illegal characters in URL path
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Thu Oct 20, 2016 12:55 pm    Post subject: Reply with quote

$ 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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Elfriede
Halfop


Joined: 07 Aug 2007
Posts: 67

PostPosted: Thu Oct 20, 2016 1:02 pm    Post subject: Reply with quote

its not caused by the $
its [] but adding "" doesnt help either :/
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Oct 20, 2016 2:12 pm    Post subject: Reply with quote

[] 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
View user's profile Send private message
Elfriede
Halfop


Joined: 07 Aug 2007
Posts: 67

PostPosted: Thu Oct 20, 2016 3:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber