cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lwx228
Level VIII

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:

 

2019-11-20_18-58.png

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!

 

14 REPLIES 14
lwx228
Level VIII

Re: How to use JSL form of "POST" WEB data?

I just tried using the original VBA, continuing with ID 5000, and still being able to download.
"report_year=2018&stock_id=600007&report_period_id=5000"
Ryan_Gilmore
Community Manager Community Manager

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

lwx228
Level VIII

Re: How to use JSL form of "POST" WEB data?

perfect.

Thank Ryan_Gilmore!

 

2019-11-25_22-21.png

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.

lwx228
Level VIII

Re: How to use JSL form of "POST" WEB data?

Thanks for the help of the experts, so that I learned a lot of skills.Thanks!