arnelgp
..forever waiting... waiting for jellybean!
- Local time
- Tomorrow, 05:49
- Joined
- May 7, 2009
- Messages
- 20,275
tried username "xxx" and "arnelgp" did get the expected results.
using username "xxx", credit: 14137
using username "arnelgp", credit: 10
using username "xxx", credit: 14137
using username "arnelgp", credit: 10
Code:
Public Function CheckCredits()
Dim oHttp As Object
Dim SMSCredits
Dim strUrl, strUsername, strPassword, strMessage, strMobileNumber As String
Set oHttp = CreateObject("Microsoft.XMLHTTP")
strUsername = "kxxx"
strPassword = "kxxx"
'strUsername = "arnelgp"
'strPassword = "arnelgp"
strUrl = "http://www.mymobileapi.com/api5/http5.aspx?Type=credits&username=" & strUsername & "&password=" & strPassword
oHttp.Open "POST", strUrl, False
oHttp.Send
Dim sResult As String
Dim nPos As Long
Dim strResult As String
sResult = oHttp.ResponseText
nPos = InStr(sResult, "<result>")
If nPos <> 0 Then
strResult = Mid(sResult, nPos + Len("<result>"))
strResult = Left(strResult, InStr(strResult, "</result>") - 1)
End If
If strResult = "True" Then
nPos = InStr(sResult, "<credits>")
strResult = Mid(sResult, nPos + Len("<credits>"))
strResult = Left(strResult, InStr(strResult, "</credits>") - 1)
SMSCredits = CDbl(strResult)
Else
MsgBox "A SMS account has not been created for you. Kindly notify us about this", vbCritical, "Notice"
End If
Set oHttp = Nothing
CheckCredits = SMSCredits
End Function