ãµã¼ãã§Webãµã¤ãã«ã¢ã¯ã»ã¹ããã«ã¯ï¼
ãµã¼ãä¸ã§ãç°ãªããµã¼ãã¸HTTPã¢ã¯ã»ã¹ãè¡ããã¨ãã§ãããServerXMLHTTPã調ã¹ãã®ã§ã¡ã¢ããã§ããã¾ã¨ãã
æ¦è¦
ServerXMLHTTP ã¯ããµã¼ãã¼é㧠HTTP ã¢ã¯ã»ã¹ãè¡ãããã®ã¡ã½ããã¨ããããã£ãæä¾ãã¦ããã¾ãã
使ãæ¹
詳ããã¯MSDNåç
§ãã¬ã¬ã·ã¼ASPã®è¨è¿°æ¹æ³ãè¼ã£ã¦ãã¾ã(JScript)ãUsing ServerXMLHTTP Directly | Microsoft Docs
<% Dim objSrvHTTP Set objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0") Call objSrvHTTP.open("GET", "http://example.com/hoge.html", True) Call objSrvHTTP.send() Response.ContentType = "text/html" Response.Write( objSrvHTTP.responseText ) Set objSrvHTTP = Nothing %>
- å¿çãå®äºããã¾ã§ããããªå¾ ã¤ã®ã§ããã°ãSend å¾ã«ä»¥ä¸ãå®è¡ããããã«ãã
While objXMLHttp.readyState <> 4 objXMLHttp.waitForResponse 1000 Wend
ServerXMLHTTPã¡ã³ãã¼
è±èªãããªãã»ã»ã»ãã¨ããã©ãã訳ãã¦ã¿ã¾ããã注èã¯åæã®èª¬æã§ãã
IServerXMLHTTPRequest-ServerXMLHTTP Members | Microsoft Docs
ããããã£
- [R/W] onreadystatechange
- è¦æ±ç¶æ ãå¤æ´ãããã¨ãã«å¼åºãããé¢æ°å *1
- [R/-] responseBody
- å¿çå 容(ãã¤ãé å) *2
- [R/-] readyState
- è¦æ±ã®ç¶æ *3
- [R/-] responseStream
- å¿çå 容(IStreamå) *4
- [R/-] responseText
- å¿çå 容(æååå) *5
- [R/-] responseXML
- å¿çå 容(XMLæåå)ãMSXMLã§æ§æ解ææ¸ã¿ã *6
- [R/-] status
- HTTPã¹ãã¼ã¿ã¹ã³ã¼ã *7
- [R/-] statusText
- HTTPã¹ãã¼ã¿ã¹ *8
ã¡ã½ãã
- abort()
- è¦æ±ã®ãã£ã³ã»ã« *9
- getAllResponseHeaders()
- HTTPããããåå¾ããï¼å ¨ã¦ï¼ *10
- getOption(option)
- ãªãã·ã§ã³å¤åå¾ *11
optionï¼ä¸è¨ãªãã·ã§ã³å¤åç § - getResponseHeader(bstrHeader)
- HTTPããããåå¾ããï¼ååæå®ï¼ *12
bstrHeaderï¼ãããå - open(bstrMethod, bstrUrl, [bAsync], [bstrUser], [bstrPassword])
- è¦æ±ãåæåããæ¹æ³(GET/POSTãªã©)ãURLãèªè¨¼æ¹æ³ãè¨å®ãã¾ãã *13
bstrMethodï¼HTTPã¡ã½ãã
bstrUrlï¼ãªã¯ã¨ã¹ãURLã"http://ã"ãã"../MyPath/hoge.htm"
bAsyncï¼è¦å®å¤ã¯ Falseãåæ(True)ããéåæ(False)
bstrUserï¼èªè¨¼(ã¦ã¼ã¶å)ãNullã空æåã¯ãã°ã¤ã³ãã¤ã¢ãã°ã表示ããã
bstrPasswordï¼èªè¨¼(ãã¹ã¯ã¼ã) - send(varBody)
- è¦æ±ã®éä¿¡ *14
varBodyï¼è¦æ±æã«éãããã£ã¼é¨ãPOSTããéãªã©ã«ä½¿ç¨ã - setOption(option, value)
- ãªãã·ã§ã³å¤è¨å® *15
optionï¼ä¸è¨ãªãã·ã§ã³å¤åç §
value:ãªãã·ã§ã³ã«è¨å®ããå¤ - setProxy(proxySetting, varProxyServer, varBypassList)
- ãããã·è¨å® *16
proxySettingï¼0(ããã©ã«ã)ã1(ãã¤ã¬ã¯ã)ã2(ãããã·çµç±)
varProxyServerï¼ãµã¼ãå
varBypassListï¼ãã¤ã¬ã¯ãã«æ¥ç¶ãããã¹ãåãIPã¢ãã¬ã¹ - setProxyCredentials(username, password)
- ãããã·ã®è¨¼ææ¸è¨å® *17
usernameï¼ãããã·å©ç¨ã®çºã®ã¦ã¼ã¶å
passwordï¼ãããã·å©ç¨ã®çºã®ãã¹ã¯ã¼ã - setTimeouts(resolveTimeout, connectTimeout, sendTimeout, receiveTimeout)
- ã¿ã¤ã ã¢ã¦ãè¨å® *18
- setRequestHeader(bstrHeader, bstrValue)
- HTTPãããã®è¨å® *19
bstrHeaderï¼ãããå
bstrValueï¼ãããå¤
æ¢å®å¤ã®User-Agentã¯ã"Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)" ãªã©ã¨ãªãããã§ã(æå¾ã®æ°åã¯ãã¼ã¸ã§ã³ï¼)ãæ¸ãæãå¯è½ã - waitForResponse([timeoutInSeconds])
- å¿çå¾
æ©æé *20
timeoutInSecondsï¼åææã®å¾ ã¡æé[ããªç§]
ãªãã·ã§ã³å¤
- -1ï¼SXH_OPTION_URL
- ãªã½ã¼ã¹ã®URLãå«ãæåååã®ããªã¢ã³ããè¿ãã¾ãã
- 0ï¼SXH_OPTION_URL_CODEPAGE
- ããã©ã«ãã® CP_UTF8 ã¯ã(opené¢æ°ã«æå®ããã) Unicode URLæååãã·ã³ã°ã«ãã¤ã表ç¾ã«å¤æããããã«ç¨ããããã³ã¼ããã¼ã¸ã§ãã
- 1ï¼SXH_OPTION_ESCAPE_PERCENT_IN_URL
- æ¢å®å¤ã¯ãANSIæåãå«ãURLãã¨ã¹ã±ã¼ããã¾ããã(" " -> "%20")
- 2ï¼SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS
- SSL証ææ¸ã§ã¨ã©ã¼ãæ¤ç¥ããå ´åã®åä½ãè¨å®ã§ãã¾ããæ¢å®å¤ã¯ãå ¨ã¦ã®ã¨ã©ã¼ãç¡è¦ãã¾ãã
- 3ï¼SXH_OPTION_SELECT_CLIENT_SSL_CERT
- ï¼ï¼ï¼
*1:Specifies the event handler to be invoked when the readyState property changes. Read/write.
*2:Represents the response entity body as an array of unsigned bytes. Read-only.
*3:Represents the state of the request. Read-only.
*4:Represents the response entity body as an IStream. Read-only.
*5:Represents the response entity body as a string. Read-only.
*6:Represents the response entity body as parsed by MicrosoftR XML Core Services (MSXML). Read-only.
*7:Represents the HTTP status code returned by a request. Read-only.
*8:Represents the HTTP response line status. Read-only.
*9:Cancels the current HTTP request.
*10:Retrieves the values of all the HTTP headers.
*11:Returns the value of one of the following options:
*12:Retrieves the value of an HTTP header from the response body.
*13:Initializes a request and specifies the method, URL, and authentication information for the request.
*14:Sends an HTTP request to the server and receives a response.
*15:Sets one of the following options:
*16:Specify proxy configuration.
*17:Specify proxy authentication credentials.
*18:Specifies timeout settings for resolving the domain name, establishing the connection to the server, sending the data, and receiving the response.
*19:Specifies the name of an HTTP header.
*20:Allows the requesting server to suspend execution while waiting for an asynchronous send operation to complete.