私はウェブサイトからデータを取得するプロジェクトを行っています。htmlページには、Excelファイルにデータを保存するオプションがあります。input要素は次のようになります。
<input type="button" id="SaveXLS" class="func_button excel_sel" title="some title" onclick="doSave2XLS(1886);">
以下は、フォームを送信するためのヘッダーです。手動でボタンをクリックして、データをファイルに保存した後です。送信されたフォームと生成されたデータに基づいてプログラムでファイルを保存したい:
http://www.somewebsite.com/iss/modules/dosearch.asp
POST /iss/modules/dosearch.asp HTTP/1.1
Host: www.somewebsite.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: text/html, */*; q=0.01
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://www.somewebsite.com/dbsearch/dbsearchru/companies/
Content-Length: 352
Cookie: ssid=198455487; ASPSESSIONIDQSBATRTS=GLKHPLMDGMBMNCGPIBDFDJNK; have_cookies=1; b=b; bask%5Fid=708D9FFEF85146BC9C50AA2B101F153D; storedID=5777322648552; user%5Flogin=CGUTST; sessionid=198455487; ASPSESSIONIDSQAATQSS=LDGPAKNDAEOOHEJPAPCNCKHN; ASPSESSIONIDQQDCTRSS=MACDCIODILPFNHAFEJMLJCCO; ASPSESSIONIDQSACSRSS=FEOLDGPDIJJOCHKAKLEIICGD; ASPSESSIONIDQSDCTRST=CFFLHEBALAGBCMHBPIGDHLBN; ASPSESSIONIDQQBCTQTS=NDOBIIBAGFFEBKCHDELOCIEP; ASPSESSIONIDQSBDSRTT=GGJFKMBAHHJAHLDLPAPCCFOP; ASPSESSIONIDSSAASRST=ADFFOACAPFMPIGKMFOCEPGAL; ASPSESSIONIDSSCBSRTS=EPPPPECAKIIAIIFGADGNFHOB; ASPSESSIONIDQSCDQQTS=IDAKMKHANNHLMGEMKCPNKAKA; 1stopen=1; ASPSESSIONIDQQABSRTS=LPLDOIIAKPNOJMJILGFCLPAG
Pragma: no-cache
Cache-Control: no-cache
company=&strict=1&phone=&address=&ruler=&constitutor=®ions=&is_okato=1®_excl=0&industry=&is_okonh=0&ind_excl=0&ind_main=0&okopf=&okopf_excl=0&okfs=&okfs_excl=0&rfi=-1&rfi_excl=0&status=&status_excl=0&trades=000&gaap=0&bankrupt=0&kod=&kod_type=1&dbeg=&dend=&group_id=0&page_no=1&rcount=30&user_id=1886&top1000=0&group_name=&fas=&fas_excl=0&rgstr=0
HTTP/1.1 200 OK
Date: Thu, 13 Dec 2012 00:42:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 18894
Content-Type: text/html
Expires: Thu, 13 Dec 2012 00:42:49 GMT
Set-Cookie: ssid=198455487; expires=Mon, 14-Jan-2013 20:00:00 GMT; path=/
Cache-Control: private
----------------------------------------------------------
http://www.somewebsite.com/iss/modules/doSave2XLS_sel.asp
POST /iss/modules/doSave2XLS_sel.asp HTTP/1.1
Host: www.somewebsite.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://www.somewebsite.com/dbsearch/dbsearchru/companies/
Cookie: ssid=198455487; ASPSESSIONIDQSBATRTS=GLKHPLMDGMBMNCGPIBDFDJNK; have_cookies=1; b=b; bask%5Fid=708D9FFEF85146BC9C50AA2B101F153D; storedID=5777322648552; user%5Flogin=CGUTST; sessionid=198455487; ASPSESSIONIDSQAATQSS=LDGPAKNDAEOOHEJPAPCNCKHN; ASPSESSIONIDQQDCTRSS=MACDCIODILPFNHAFEJMLJCCO; ASPSESSIONIDQSACSRSS=FEOLDGPDIJJOCHKAKLEIICGD; ASPSESSIONIDQSDCTRST=CFFLHEBALAGBCMHBPIGDHLBN; ASPSESSIONIDQQBCTQTS=NDOBIIBAGFFEBKCHDELOCIEP; ASPSESSIONIDQSBDSRTT=GGJFKMBAHHJAHLDLPAPCCFOP; ASPSESSIONIDSSAASRST=ADFFOACAPFMPIGKMFOCEPGAL; ASPSESSIONIDSSCBSRTS=EPPPPECAKIIAIIFGADGNFHOB; ASPSESSIONIDQSCDQQTS=IDAKMKHANNHLMGEMKCPNKAKA; 1stopen=1; ASPSESSIONIDQQABSRTS=LPLDOIIAKPNOJMJILGFCLPAG
Content-Type: application/x-www-form-urlencoded
Content-Length: 1251
uid=1886&iss=%27on%27%2C%27AABAAD075E0470BEC325674A0039F724%27%2C%273DC84DD11D61CC51C32567400032199E%27%2C%27FB9900A46791499BA0535468BC3CFA39%27%2C%27E21096B5CCABA8424325685700350F60%27%2C%2795345C101FAE47979E25CBF409044F11%27%2C%2791001D2C33036B8C43256735005A6F38%27%2C%27A407F1FA59BB4243A2321D1D561D05FC%27%2C%27038D4548E9E3448DA85C397BB8E7813C%27%2C%2743256B410056E49F43256B6600535ADB%27%2C%277A3678AD5AE14B0A945D0EB6B7919F6E%27%2C%273E7F2B1C9DF045C2B490D064C27012E0%27%2C%2709D6465D27A13F4443256918005508F6%27%2C%27432569290063957443256A3C002D1886%27%2C%2706303D64278B47F143256735005AB499%27%2C%2799F954C23CAB4D5884AC647F1D03A991%27%2C%273A4856543CEF4C7BA37F4CFBA837EA23%27%2C%27612B5284D9604368B86A3CFF7BF84916%27%2C%2714C8FC8A807C4F46AB8DE94C29F5DA20%27%2C%27B44C85F39BA64922BAC5E665DD9D968C%27%2C%27A4519C3DC0CB4F8E83EA3CBCB19DC60C%27%2C%2741DDBC39B3584C5CB81ABF9B3EFA91E5%27%2C%27D3068AD3F90441E7B8ABCCE5ADD12D07%27%2C%277E75E0F682AD84B4C3256763002EA999%27%2C%27A1DAA1A271404F049AB543DC7FD14CC5%27%2C%27A43E335F235F4F5CA087B2B1B42304BC%27%2C%275E7E15B019C84AA188BFB03B5C416639%27%2C%27F695456883C04C91B47D204576FA6033%27%2C%27E765622FA33F4B13AAC56348E62C69C5%27%2C%2741113AD02A6A43F9A6A6F20D0CDEA7F1%27%2C%270F36F00CC10F4E60B9226BCE04EA462B%27
HTTP/1.1 200 OK
Date: Thu, 13 Dec 2012 00:42:58 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Disposition: attachment; filename=1886442458.xls;
Content-Length: 33491
Content-Type: application/vnd.ms-excel
Expires: Thu, 13 Dec 2012 00:42:58 GMT
Set-Cookie: ssid=198455487; expires=Mon, 14-Jan-2013 20:00:00 GMT; path=/
Cache-Control: private
----------------------------------------------------------
http://www.somewebsite.com/tramp/tramp_session.asp
GET /tramp/tramp_session.asp HTTP/1.1
Host: www.somewebsite.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Referer: http://www.somewebsite.com/dbsearch/dbsearchru/companies/
Cookie: ssid=198455487; ASPSESSIONIDQSBATRTS=GLKHPLMDGMBMNCGPIBDFDJNK; have_cookies=1; b=b; bask%5Fid=708D9FFEF85146BC9C50AA2B101F153D; storedID=5777322648552; user%5Flogin=CGUTST; sessionid=198455487; ASPSESSIONIDSQAATQSS=LDGPAKNDAEOOHEJPAPCNCKHN; ASPSESSIONIDQQDCTRSS=MACDCIODILPFNHAFEJMLJCCO; ASPSESSIONIDQSACSRSS=FEOLDGPDIJJOCHKAKLEIICGD; ASPSESSIONIDQSDCTRST=CFFLHEBALAGBCMHBPIGDHLBN; ASPSESSIONIDQQBCTQTS=NDOBIIBAGFFEBKCHDELOCIEP; ASPSESSIONIDQSBDSRTT=GGJFKMBAHHJAHLDLPAPCCFOP; ASPSESSIONIDSSAASRST=ADFFOACAPFMPIGKMFOCEPGAL; ASPSESSIONIDSSCBSRTS=EPPPPECAKIIAIIFGADGNFHOB; ASPSESSIONIDQSCDQQTS=IDAKMKHANNHLMGEMKCPNKAKA; 1stopen=1; ASPSESSIONIDQQABSRTS=LPLDOIIAKPNOJMJILGFCLPAG
HTTP/1.1 200 OK
Date: Thu, 13 Dec 2012 00:43:13 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 0
Content-Type: text/html
Expires: Thu, 13 Dec 2012 00:43:13 GMT
Set-Cookie: ssid=198455487; expires=Mon, 14-Jan-2013 20:00:00 GMT; path=/
Cache-Control: private
ありがとう。