手写HTTP请求,关于multipart/form-data类型的body(加密sql语句和xml)
方法1:此方法已实践,但请求失败,在官网资料显示,可运用此方法请求,猜测此方法不适合我实践的过程,希望引用此方法的大神小心求证。
web_custom_request("process.ashx",
"URL=http://{IP}/process.ashx?useridentify=&action=editdata",
"Method=POST",
"EncType=multipart/form-data; boundary=----------121813174743227",
"Resource=0",
"RecContentType=text/html",
"Snapshot=t1.inf",
"Mode=HTTP",
"Body=----------121813174743227\r\n"
"Content-Disposition: form-data; name=\"sqlstr\"\r\n"
"c2VsZWN0ICogZnJvbSBleGFtcm9vbXVzZXIgd2hlcmUgZXhhbXJvb21ndWlkID0gJzNhZjJiOGIyLWNmZGQtNDBmOC05YzYyLWI5ZjY0MzEyZWViZCcgYW5kIHVzZXJndWlkID0gJ2I5MjY5NTc0LWQxMTUtNGMzYy1hMmU2LWViNmI2MzQ1ZmVkMic=\r\n"
"----------121813174743227\r\n"
"Content-Disposition: form-data; name=\"objstr\"\r\n"
"\r\n"
"<data><guid>{9BDE1656-3CAD-4234-B18C-E1D822424C43}</guid><examroomguid>3af2b8b2-cfdd-40f8-9c62-b9f64312eebd</examroomguid><userguid>b9269574-d115-4c3c-a2e6-eb6b6345fed2</userguid><score>112</score><getscore>{score}</getscore><ischeat>False</ischeat><fraudreason></fraudreason></data>\r\n"
"----------121813174743227--",
LAST);
方法2:此方法已实践通过,请放心引用
web_submit_data("process.ashx",
"Action=http://{IP}/process.ashx?useridentify=&action=editdata",
"Method=POST",
"EncType=multipart/form-data",
"RecContentType=text/html",
"Snapshot=t89.inf",
"Mode=HTTP",
ITEMDATA,
"Name=sqlstr", "Value=c2VsZWN0ICogZnJvbSBleGFtcm9vbXVzZXIgd2hlcmUgZXhhbXJvb21ndWlkID0gJzNhZjJiOGIyLWNmZGQtNDBmOC05YzYyLWI5ZjY0MzEyZWViZCcgYW5kIHVzZXJndWlkID0gJ2I5MjY5NTc0LWQxMTUtNGMzYy1hMmU2LWViNmI2MzQ1ZmVkMic=", ENDITEM,
"Name=objstr", "Value=<data><guid>{9BDE1656-3CAD-4234-B18C-E1D822424C44}</guid><examroomguid>3af2b8b2-cfdd-40f8-9c62-b9f64312eebd</examroomguid><userguid>{UserID}</userguid><score>112</score><getscore>{score}</getscore><ischeat>False</ischeat><fraudreason></fraudreason></data>", ENDITEM,
LAST);