我想从网站获取HTML文档结构,以便从中提取信息。我使用GET请求,但它返回416状态。在其他网站上,这种简单的GET请求足以得到答复。
Dim oXMLHTTP As New MSXML2.ServerXMLHTTP
Dim htmlObj As New HTMLDocument
With oXMLHTTP
.Open "GET", "http://www.manta.com/ic/mtqyfk0/ca/riverbend-holdings-inc", False
.send
If .ReadyState = 4 And .Status = 200 Then
Set htmlObj = CreateObject("htmlFile")
htmlObj.body.innerHTML = .responseText
'do things
End If
End With
答案 0 :(得分:1)
您应该只能使用 Timestamp ts;
//give some value to ts
Time time ;
//give some value to time
//Calendar based on ts
Calendar cTs=Calendar.getInstance();
cTs.setTimeInMillis(ts.getTime());
//Calendar based on time
Calendar cTime=Calendar.getInstance();
cTime.setTimeInMillis(time.getTime());
cTs.set(Calendar.HOUR_OF_DAY, cTime.get(Calendar.HOUR_OF_DAY));
cTs.set(Calendar.MINUTE, cTime.get(Calendar.MINUTE));
cTs.set(Calendar.SECOND, cTime.get(Calendar.SECOND));
cTs.set(Calendar.MILLISECOND, cTime.get(Calendar.MILLISECOND));
//set value of ts based on the modified cTs
ts.setTime(cTs.getTimeInMillis());
System.out.println(ts.getTime());
代替XMLHTTP
ServerXMLHTTP
为我返回 Dim oXMLHTTP As New MSXML2.XMLHTTP60
。