Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ask] coding VB.net Error clsHTTP
#1
Maaf om2 klo threadnya slah Cheer
ane cuma tanya ini ad yg slah.
terus cara beneri codingnya gmn y ?Bingung


PHP Code:
Imports System.Xml Imports System.IO Public Class Form1 Dim sck As New clsHTTP Private Delegate Sub str(ByVal x As String) Dim mStep As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click With sck .Reset() .CookieFile = Application.StartupPath & "\cookies.xml" .Method = clsHTTP.postMethodEnum.POST .PostType = clsHTTP.PostTypeEnum.URLENCODED .Url = "http://www.fileserve.com/login.php" .Timeout = 20000 .AddParam("loginUserName", txtUser.Text) .AddParam("loginUserPassword", txtPass.Text) .AddParam("autoLogin", "on") .AddParam("loginFormSubmit", "Login") Debug.WriteLine("Connectng") mStep = 1 .ExecuteAsync() End With End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler sck.Failed, AddressOf sckFailed AddHandler sck.Complete, AddressOf sckComplete End Sub Private Sub sckComplete(ByVal sData As String) If Me.InvokeRequired Then Dim d As New str(AddressOf sckComplete) Me.BeginInvoke(d, New Object() {sData}) Else Try Debug.Print(sData) If mStep = 1 Then If sData.Contains(">Dashboard<") Then Dim tmpType As String = ParseMid(sData, "<h5>Account type", "</td>") If tmpType.Contains("<h3>Premium") Then lblAccountType.Text = "Premium" Else lblAccountType.Text = "Free User" End If Dim tmpEarn As String = ParseMid(sData, "<h5>Total Earnings", "</h3>") lblEarning.Text = "$" & ParseMid(tmpEarn, "normal;"">", "</span>") Dim fU As String = ParseMid(sData, "<h5>Files uploaded", "</h3>") lblFU.Text = ParseMid(fU, "<h3>", "<span>") Dim dL As String = ParseMid(sData, "<h5>Download speed", "</h3>") lblDLS.Text = ParseMid(dL, "<h3>", "<span>") & "KB/s" Dim storage As String = ParseMid(sData, "<h5><span>Storage", "Byte</span>") Dim gb As String = ParseMid(sData, "<span> Byte</span>", "<span> GB</span>") lblStorage.Text = Replace(ParseMid(storage, "<h3>", "<span>"), " ", "") & "Bytes" & Replace(ParseMid(gb, "<span> Byte</span>", "<span> GB</span>"), " ", "") & "/500GB" Else MessageBox.Show("Login Failed For Fileserve", "checker") End If End If Catch ex As Exception End Try End If End Sub Public Function ParseMid(ByVal strData As String, ByVal strStart As String, ByVal strStop As String, Optional ByVal mReverse As Boolean = False) As String Dim iStart As Integer = 0 Dim iStop As Integer = 0 Try If mReverse Then iStart = strData.LastIndexOf(strStart) Else iStart = strData.IndexOf(strStart, 0) End If If iStart <= 0 Then Return "" iStop = strData.IndexOf(strStop, iStart + strStart.Length) If iStop = 0 Then Return strData.Substring(iStart + strStart.Length) Else Return strData.Substring(iStart + strStart.Length, iStop - iStart - strStart.Length) End If Catch ex As Exception Return "" End Try End Function Private Sub sckFailed(ByVal mErr As String) If Me.InvokeRequired Then Dim d As New str(AddressOf sckFailed) Me.BeginInvoke(d, New Object() {mErr}) Else End If End Sub End Class


Salahnya di sini om.
[Image: Untitled-32.png]
[Image: animasi_xcode1-1.gif]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Ask] Coding DDOS Attack VB6 cyberlaros 3 67 03-14-2014, 11:16 AM
Last Post: arjuna
  [ASK] error crystl32.OCX uzumady 4 32 09-05-2013, 11:20 PM
Last Post: mydisha
  Mengatasi error di Vb dengan Error handling mydisha 8 143 03-03-2011, 04:21 PM
Last Post: mydisha
  VB 6 tiba2 kok Error ? fade2 4 40 01-20-2011, 07:01 PM
Last Post: Amirul Darmawan

Forum Jump:


Users browsing this thread: 1 Guest(s)