cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

How to change the VBA of excel to JSL in order to download data?

Hello, everyone!

The VBA can download data from this website.But I don't know how to change it to JSL to make it work.

Thank you very much!

Sub Post()
Dim User_agent, Url_Post
User_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
Url_Post = "http://excalc.icfqs.com:7616/TQLEX?Entry=HQServ.hq_nlp"
Post_data = "[{""funcId"":4,""cond"":""code,1603969|"",""modname"":""TickAly""}]"
With CreateObject("WinHttp.WinHttpRequest.5.1")
    .Open "post", Url_Post, False
    .SetRequestHeader "User-Agent", User_agent
    .Send (Post_data)
    Debug.Print .Responsetext
End With
End Sub
1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

回复: 这样的网址怎样才能编写脚本才能下载数据?

Use JMP's http request, just like VB.

 

The octet stream means you need blobToChar conversion.The octet stream means you need blobToChar conversion.

Craige

View solution in original post

4 REPLIES 4
lala
Level VII

回复: 这样的网址怎样才能编写脚本才能下载数据?

POST:
http://excalc.icfqs.com:7616/TQLEX?Entry=HQServ.hq_nlp HTTP/1.1
Host: excalc.icfqs.com:7616
Proxy-Connection: keep-alive
Content-Length: 85
Origin: http://excalc.icfqs.com:7616
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Content-Type: text/plain
Accept: */*
Referer: http://excalc.icfqs.com:7616/site/tdx-zbfx/page-detail.html?setcode=1&code=688262&name=%E5%9B%BD%E8%8A%AF%E7%A7%91%E6%8A%80&color=0
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7
Cookie: ASPSessionID=

[{"funcId":1,"offset":0,"count":200,"cond":"code,1688262|INT,3","modname":"TickAly"}]
lala
Level VII

回复: 这样的网址怎样才能编写脚本才能下载数据?

2022-03-30_18-05-06.png

lala
Level VII

回复: 这样的网址怎样才能编写脚本才能下载数据?

VBA code, I just don't know how to change to JSL.

Experts are invited to guide.Thank you very much!

Sub Post()
Dim User_agent, Url_Post
User_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
Url_Post = "http://excalc.icfqs.com:7616/TQLEX?Entry=HQServ.hq_nlp"
Post_data = "[{""funcId"":4,""cond"":""code,1603969|"",""modname"":""TickAly""}]"
With CreateObject("WinHttp.WinHttpRequest.5.1")
    .Open "post", Url_Post, False
    .SetRequestHeader "User-Agent", User_agent
    .Send (Post_data)
    Debug.Print .Responsetext
End With
End Sub

2022-04-01_15-24-01.png

Craige_Hales
Super User

回复: 这样的网址怎样才能编写脚本才能下载数据?

Use JMP's http request, just like VB.

 

The octet stream means you need blobToChar conversion.The octet stream means you need blobToChar conversion.

Craige