|
我在给自己的博客加trackback ping时,在发送时总是出现ObjXMLHTTP.Status为500的错误,不知道是怎么回事。希望高手帮我解决一下,代码如下:
Function Trackback(trackback_url, url, title, excerpt, blog_name)
Dim query_string, objXMLHTTP, objDOM
title = cutStr(Server.URLEncode(title),100)
excerpt = cutStr(Server.URLEncode(excerpt), 252)
url = Server.URLEncode(url)
blog_name = Server.URLEncode(blog_name)
query_string = "title="&title&"&url="&url&"&blog_name="&blog_name&"&excerpt="&excerpt
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
Set objDom = Server.CreateObject("Microsoft.XMLDOM")
objXMLHTTP.Open "POST", trackback_url, false
objXMLHTTP.setRequestHeader "Content-Type","application/x-www-Form-urlencoded"
'HAndling timeout
On Error Resume Next
objXMLHTTP.SEnd query_string
If objXMLHTTP.readyState <> 4 Then
objXMLHTTP.waitForResponse 15
End If
If Err.Number <> 0 Then
Trackback = "0$$TrackBack 错误:无法连接服务器"
Else
If (objXMLHTTP.readyState <> 4) Or (objXMLHTTP.Status <> 200) Then
objXMLHTTP.Abort
Trackback = "0$$Trackback 超时"
Else
objDom.async=false
objDom.loadXML(objXMLHTTP.responseText)
If objDom.parseError.errorCode <> 0 Then
Trackback = "0$$TrackBack 响应解析错误"
Else
If objDom.getElementsByTagName("error")(0).Text="0" Then
Trackback = "1$$Trackback 成功"
Else
Trackback = "0$$Trackback 错误:"&objDom.getElementsByTagName("message")(0).Text
End If
End If
End If
End If
Set objXMLHTTP = Nothing
Set objDom = Nothing
End Function |
|