Desain tampilannya adalah sebagai berikut :
Codingnya adalah sebagai berikut :
Imports System.IO
Imports System.Net
Imports System.Text
Public Class Form1
Private Sub buttonGo_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles buttonGo.Click
Dim uri As New Uri(textUrl.Text)
Dim builder As New StringBuilder()
builder.Append(“AbsolutePath: ” & uri.AbsolutePath & ControlChars.CrLf)
builder.Append(“AbsoluteUri: ” & uri.AbsoluteUri & ControlChars.CrLf)
builder.Append(“Host: ” & uri.Host & ControlChars.CrLf)
builder.Append(“HostNameType: ” & uri.HostNameType.ToString() & _
ControlChars.CrLf)
builder.Append(“LocalPath: ” & uri.LocalPath & ControlChars.CrLf)
builder.Append(“PathAndQuery: ” & uri.PathAndQuery & ControlChars.CrLf)
builder.Append(“Port: ” & uri.Port & ControlChars.CrLf)
builder.Append(“Query: ” & uri.Query & ControlChars.CrLf)
builder.Append(“Scheme: ” & uri.Scheme)
MsgBox(builder.ToString())
Dim request As WebRequest = WebRequest.Create(uri)
Dim response As WebResponse = request.GetResponse()
builder = New StringBuilder()
builder.Append(“Request type: ” & request.GetType().ToString() & _
ControlChars.CrLf)
builder.Append(“Response type: ” & response.GetType().ToString() & _
ControlChars.CrLf)
builder.Append(“Content length: ” & response.ContentLength & _
” bytes” & ControlChars.CrLf)
builder.Append(“Content type: ” & response.ContentType & _
ControlChars.CrLf)
MsgBox(builder.ToString())
Dim stream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(stream)
Dim data As String = reader.ReadToEnd()
reader.Close()
stream.Close()
textData.Text = data
End Sub
End Class
Mungkin ada tambahan atau pertanyaan? silahkan posting dibawah
Codingnya adalah sebagai berikut :
Imports System.IO
Imports System.Net
Imports System.Text
Public Class Form1
Private Sub buttonGo_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles buttonGo.Click
Dim uri As New Uri(textUrl.Text)
Dim builder As New StringBuilder()
builder.Append(“AbsolutePath: ” & uri.AbsolutePath & ControlChars.CrLf)
builder.Append(“AbsoluteUri: ” & uri.AbsoluteUri & ControlChars.CrLf)
builder.Append(“Host: ” & uri.Host & ControlChars.CrLf)
builder.Append(“HostNameType: ” & uri.HostNameType.ToString() & _
ControlChars.CrLf)
builder.Append(“LocalPath: ” & uri.LocalPath & ControlChars.CrLf)
builder.Append(“PathAndQuery: ” & uri.PathAndQuery & ControlChars.CrLf)
builder.Append(“Port: ” & uri.Port & ControlChars.CrLf)
builder.Append(“Query: ” & uri.Query & ControlChars.CrLf)
builder.Append(“Scheme: ” & uri.Scheme)
MsgBox(builder.ToString())
Dim request As WebRequest = WebRequest.Create(uri)
Dim response As WebResponse = request.GetResponse()
builder = New StringBuilder()
builder.Append(“Request type: ” & request.GetType().ToString() & _
ControlChars.CrLf)
builder.Append(“Response type: ” & response.GetType().ToString() & _
ControlChars.CrLf)
builder.Append(“Content length: ” & response.ContentLength & _
” bytes” & ControlChars.CrLf)
builder.Append(“Content type: ” & response.ContentType & _
ControlChars.CrLf)
MsgBox(builder.ToString())
Dim stream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(stream)
Dim data As String = reader.ReadToEnd()
reader.Close()
stream.Close()
textData.Text = data
End Sub
End Class
Mungkin ada tambahan atau pertanyaan? silahkan posting dibawah
0 komentar:
Posting Komentar