标题:关于objXMLHTTP错误的问题
只看楼主
bybok
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-6-14
 问题点数:0 回复次数:2 
关于objXMLHTTP错误的问题
我在给自己的博客加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
搜索更多相关主题的帖子: objXMLHTTP 
2008-06-14 14:38
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
得分:0 
500是服务器内部错误……
2008-06-14 14:49
bybok
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-6-14
得分:0 
老大,要怎么处理呢
2008-06-14 14:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-219147-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.395781 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved