Yahoo!JapanãMHTMLã«ãã¦ã¿ã
WSH使ã£ãã¹ã¯ãªãããmht.js
///////////JSããCDOã使ã£ã¦ãMHTMLãä½æãã var obj = WScript.CreateObject("CDO.Message"); var filename = "test.mht"; var url = "http://www.yahoo.co.jp/"; obj.MimeFormatted = true; obj.CreateMHTMLBody( url, 0, "", "" ); obj.GetStream().SaveToFile( filename, 1 );
åèã«ãããã®
åºæ¥ä¸ãã£ãMHTMLã®ä¸èº«
thread-index: AcgKhmRFFkspMVI3QSeZX/AcFCZgwg== MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_0001_01C80AD1.D4E21C90" Content-Location: http://www.yahoo.co.jp/ Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C80AD1.D4E21C90 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0002_01C80AD1.D4E21C90" ------=_NextPart_001_0002_01C80AD1.D4E21C90 Content-Type: text/plain; charset="euc-jp" Content-Transfer-Encoding: base64 pLOkzqXaobyluKTypbmlv6G8pcil2qG8pbiky8DfxOqkuaTrpLOkzqXaobyluKTypbmlv6G8pcil 2qG8pbiky8DfxOqkuaTrDQqkqsbApMfK2M34pMqltaG8pdOluaSspKSkw6TRpKQJIA0KCSANCgkg DQoJIA0KWWFob28hIEpBUEFOIA0KCSANCg0KDQoNCltuZXddy9zG/KXJpeml3qTis6u7z6GqocjG r6Stpd6l86HJpL+kwaSszLTD5qTLpMqk67DCzO6l4qXopbOkzsCks6YgLSBbbmV3XcG0ufGkzsDk t8q5yM3Vpbml3aXDpci+8MrzIAkNCgkgDQoJDQoJICAgICAJpaalp6XWuKG69yAJILihuvelqqXX pbel56XzCSANCgkgDQoJIMXQz7+ltaWkpcgJIAkgsujB/AkgCSDGsLLoCSAJIKXWpe2lsA0KvK29 8QkgCSDDzrfDwt4JIAkgw8+/3gkgCSC+psnKCSAJIA0KpcShvKXrpdChvKTLv7e1oce9xeu63KGi ..(以ä¸ç¥
HTTPã®HEADERã¨ä½ãå¤ãããªãã
ããããã¦HTTPéä¿¡å
容ããã®ã¾ã¾ä¿åããã ãã§MHTMLã«ãªãï¼
ãããããCDOãªãã¸ã§ã¯ãä½ããªãã¦ãè¯ãããï¼
HTTPã®Multipart/Formã«ã½ãã¯ãª
HTTPã§ãã©ã¼ã ã®ãã¡ã¤ã«éåä¿¡ã®å
容ã«ã½ãã¯ãªãå½ããåãã
ã¡ã½ãããCDO.GetStream().SaveToFile()ãªã®ã§Streamãç´æ¥ä¿åãã¦ãã ãã ãª
IEã®ãªã¼ããã¤ãããä¸ã«TCP/IPãDUMPããã°ï¼
CDO.Messageã¯ãªã«ãããã®ï¼
ï¼ ITï¼Windows TIPS -- Tipsï¼Windowsæ¨æºæ©è½ã¨WSHã使ã£ã¦ã¡ã¼ã«ãéä¿¡ãã
http://www.atmarkit.co.jp/fwin2k/win2ktips/428wshmail/wshmail.html
Windowsã·ã¹ãã ã«å«ã¾ããCDOã³ã³ãã¼ãã³ããå©ç¨ãããã¨ã§ãWSHã¹ã¯ãªããããã¡ã¼ã«ãéä¿¡ãããã¨ãã§ããã
ã©ãããã¡ã¼ã«éä¿¡ã©ã¤ãã©ãªãããã
ããããã»ãã®HTMLã¡ã¼ã«éä¿¡ã©ã¤ãã©ãªã§ãï¼
ããã¯ä»®å®ãææ¥ãã調ã¹ã
ãªã©ã使ãã°MHTMLã®èªã¿æ¸ããåºæ¥ãï¼
ãã ãHTMLã«å¿
è¦ãªJSãCSSãæ½åºãããããã¹ã解決ããã®ãé¢åã
LWPãfile_get_content()ãHTMLãã¡ã¤ã«ã ãã§ããã®ã»ãã®ãã¡ã¤ã«ã®èªã¿è¾¼ã¿ããµãã¼ããã¦ãããªã
éã«è¨ãã¨ããªã³ã¯ãã¹ã解決ããã©ã¤ãã©ãªãæã¤è¨èªã¯ãMHTMLããã±ã¼ã¸ãç°¡åã«ä½ããã£ã¦ãã¨
ãªãã°ã©ãããï¼
ãã¾ã®ã¨ããCDO.MessageãOfficeãWSHã§å¼ã³åºãã®ãå®å®ã
IE/Operaãæä½ããURLãä¿åãããOKãï¼IEã¯é表示ã§èµ·åã§ãããï¼
ãã ããFireFoxã¯æªå¯¾å¿ï¼ããéè¦ãæ¡å¼µããã±ã¼ã¸ã§è§£æ±ºããã¯ãï¼
Perlãªãã©ã¤ãã©ãªå¤ããï¼
ãã¹è§£æ±ºããã©ã¤ãã©ãªãä¸çªå¤ãããã ãã©CPANã¯Linuxãã¡ã¤ã³
Windowsã ã¨WSHãIronPythonãåè£ã
PHPã¯ãããå¦çã«åããªãã
Linuxã§MHTMLå½¢å¼ã使ããªããPerlãï¼ãããããã±ã¼ã¸ããªãã
ä½ãã¨ï¼ãããªæãï¼
use MHTML; my $mhtml = get_mht "http://yahoo.co.jp" ;
id:miyagawaãµã³ãä½ã£ã¦ãããªããã¨æå¾ ãã¨ãã