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 

[solved] No data returned when requesting content from https

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


Joined: 04 Jul 2006
Posts: 118
Location: France

PostPosted: Thu Apr 07, 2016 9:21 am    Post subject: [solved] No data returned when requesting content from https Reply with quote

Hello,

I'm trying to make a translator using the Yandex API at https://translate.yandex.net/api/ and I'm encountering some difficulties.

Here is what I am doing :
Code:
.tcl ::http::register https 443 ::tls::socket
Tcl: 443 ::tls::socket

.tcl ::http::geturl "https://translate.yandex.net/api/v1.5/tr.json/translate?key=MY_API_KEY&text=this%20is%20a%20test&lang=fr&format=plain&options=1" -timeout 10000
Tcl: ::http::6242

.tcl http::status ::http::6242
Tcl: ok

.tcl ::http::data ::http::6242
Tcl:

.tcl array get ::http::6242
Tcl: sock sock8 http {} querylength 0 -queryblocksize 8192 state connecting charset iso8859-1 type text/html -binary 1 url https://translate.yandex.net/api/v1.5/tr.json/translate?key=MY_API_KEY&text=this%20is%20a%20test&lang=fr&format=plain&options=1 -keepalive 0 -timeout 10000 socketinfo translate.yandex.net:443 queryoffset 0 binary 0 -strict 1 totalsize 0 -validate 0 -protocol 1.1 connection close -queryprogress {} -headers {} after after#40937 -blocksize 8192 coding {} status ok body {} currentsize 0 meta {} -type application/x-www-form-urlencoded


I replaced my own API key by MY_API_KEY in the example, but you can obtain one freely here : https://tech.yandex.com/key/form.xml?service=trnsl

As you can see, geturl returns the "ok" status but I get no data.

Tests have been made using :
Eggdrop v1.6.21 / Tcl 8.5.3 / http package 2.7.5 / tls package 1.50

Any idea would be greatly appreciated.


Edit : Problem solved, adding -tls1 1 to ::tls::socket parameters did the trick.
 
_________________
 
My releases: http://www.boulets.oqp.me/tcl/scripts/index.html
My toolbox: http://www.boulets.oqp.me/tcl/routines/index.html
 
Back to top
View user's profile Send private message Visit poster's website
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