- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to use JSL form of "POST" WEB data?
After I learned to use JMP to download web page data, ga mother likes to use JMP to download web page data now, but it is more difficult to process the web page of POST.
Get expert help: how to download data using JSL in the following way:
POST http://listxbrl.sse.com.cn/companyInfo/showBalance.do HTTP/1.1
Host: listxbrl.sse.com.cn
Connection: keep-alive
Content-Length: 54
Accept: */*
Origin: http://listxbrl.sse.com.cn
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://listxbrl.sse.com.cn/companyInfo/toCompanyInfo.do?stock_id=600007&report_period_id=5000
report_year=2018&stock_id=600007&report_period_id=5000
I can do it with VBA.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL form of "POST" WEB data?
"report_year=2018&stock_id=600007&report_period_id=5000"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL form of "POST" WEB data?
These lines of code,
query = Associative Array();
query["report_year"] = 2018;
query["stock_id"] = 600007;
query["report_period_id"] = 5000;
are used to construct the query parameter list in the URL, e.g.
report_year=2018&stock_id=600007&report_period_id=5000
In the original code I supplied, the code had
query["period_id"] = 5000;
which would have given an incorrect query parameter list of
report_year=2018&stock_id=600007&period_id=5000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL form of "POST" WEB data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL form of "POST" WEB data?
Using example in the thread, you'd want something like:
query = Associative Array(); query["report_year"] = 2018; query["stock_id"] = 600007; query["period_id"] = 5000; request = HTTP Request( Url( "http://listxbrl.sse.com.cn/companyInfo/showBalance.do" ), Method( "POST" ), Form( Fields(query) ) ); request << Send;
The Form message has been there since the beginning.
It has Fields and Files sub parts to it. Both are associative arrays.
In the "Fields" case it's name/value pairs where the value can be either character or a List of characters.
In the "Files" case it's name/value pairs where the value can be either filename or a List of filenames.
If only "Fields" is used, then the request header is automatically set to application/x-www-form-urlencoded
If "Fields" and "Files" (or just "Files") is used, then the request header is automatically set to multipart/form-data.
I'll update the thread with this information, too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL form of "POST" WEB data?
- « Previous
-
- 1
- 2
- Next »