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=5000I can do it with VBA.
Thanks!
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
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.