Tough stuff - API's

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • adamstarwars
    New Member
    • Feb 2011
    • 1

    Tough stuff - API's

    Hey Guys, just wondering if you guys could help me out here. The code is pretty complicated (for me anyway) and I have pasted it all here but highlighted the bit that's causing the error in red and emboldened it.
    The error I get is: "Compile error: Invalid qualifier"
    Thanks you in advance for your help

    Code:
    Public Function dcMozRankGet(ByVal sWebSiteURL As String) As Integer

    Sheets("Sheet2").Select

    Dim sAccessID As String
    sAccessID = Range("M1").Select

    Dim sSecretKey As String
    sSecretKey = Range("M2").Select

    Dim lExpires As Long
    lExpires = DateDiff("s", DateSerial(1970, 1, 1), Now()) + 300

    Dim sSafeSignature As String
    Dim sURLToFetch As String
    Dim sResult As String
    sWebSiteURL = HttpUtility.UrlEncode(sWebSiteURL)
    sSafeSignature = Encode(sAccessID, lExpires, sSecretKey, vbLf)
    sURLToFetch = "http://lsapi.seomoz.com/linkscape/mozrank/" & _
    sWebSiteURL & "?AccessID=" & sAccessID & "&Expires=" & lExpires & _
    "&Signature=" & sSafeSignature
    sResult = sGetData(sURLToFetch)
    sResult = Mid$(sResult, InStr(sResult, """umrp"":") + 7)
    sResult = sResult.Split(",")(0)
    dcMozRankGet = CDec(sResult)
    End Function


    Public Function Encode(ByVal sAccessID As String, _
    ByVal lExpires As Long, _
    ByVal SecretAccessKey As String, ByVal Separator As String) As String
    Dim sAccessExpires As String
    sAccessExpires = sAccessID & Separator & lExpires
    Dim strSig_UTF8 As Byte
    Dim strSignature As String
    Dim objUTF8Encoder As UTF8Encoding
    Dim objHMACSHA1 As New HMACSHA1
    objUTF8Encoder = New UTF8Encoding
    strSig_UTF8 = objUTF8Encoder.GetBytes(sAccessExpires)
    objHMACSHA1 = New HMACSHA1
    objHMACSHA1 = (bjUTF8Encoder.GetBytes(SecretAccessKey))

    strSignature = Convert.ToBase64String _
    (objHMACSHA1.ComputeHash( _
    objUTF8Encoder.GetBytes( _
    sAccessExpires.ToCharArray())))
    Encode = HttpUtility.UrlEncode(strSignature)
    End Function


    Public Function sGetData(ByVal sURL As String) As String
    Dim Writer As StreamWriter
    Writer = Nothing
    Dim WebRequestObject As HttpWebRequest
    Dim sr As StreamReader
    Dim WebResponseObject As HttpWebResponse
    Dim sbResultsBuilder As New StringBuilder
    Dim sBuffer(8192) As Char
    Dim iRetChars As Integer
    WebRequestObject = CType(WebRequest.Create(sURL), HttpWebRequest)
    WebRequestObject.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705"
    WebRequestObject.Method = "GET"
    WebRequestObject.Timeout = 55000
    WebRequestObject.ReadWriteTimeout = 55000
    WebRequestObject.AllowAutoRedirect = True
    If Not (oCookies Is Nothing) Then
    WebRequestObject.CookieContainer = oCookies
    End If
    WebResponseObject = CType(WebRequestObject.GetResponse(), HttpWebResponse)

    sr = New StreamReader
    sr = (WebResponseObject.GetResponseStream)
    Do
    iRetChars = sr.Read(sBuffer, 0, sBuffer.Length)
    If iRetChars > 0 Then sbResultsBuilder = Append(sBuffer, 0, iRetChars)
    End If
    Loop While iRetChars > 0
    sGetData = sbResultsBuilder.ToString
    End Function
  • Steve Machol
    Former Customer Support Manager
    • Jul 2000
    • 154488

    #2
    This is the vBulletin support forums. You are better off posting on a more relevant forum for this.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment

    • DelphiVillage
      Senior Member
      • Apr 2002
      • 1051
      • 4.1.x

      #3
      hi,

      oh visual basic that's years ago but i do remember that error message.The qualifier is the first part of a name in dot notation probably it means you're using a wrong name Text1.Text etc etc check the component names on your vb form

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...