https - does not work
This does not work when I try a https website like wikipedia.
Do you have any suggestions ?
Imports System.Net Imports System.IO
Private Sub scrapeButton_Click(sender As Object, e As EventArgs) Handles scrapeButton.Click 'In Here End Sub
If (Not linkURL.Text = Nothing) Then linkURL.Text = linkURL.Text.ToLower() If (linkURL.Text.StartsWith("https://") Or linkURL.Text.StartsWith("http://")) Then If (Not linkURL.Text.StartsWith("https://www.") And Not linkURL.Text.StartsWith("http://www.")) Then If Not (linkURL.Text.StartsWith("www.")) Then If (linkURL.Text.StartsWith("http://")) Then linkURL.Text = "http://www." & linkURL.Text.Substring(7, linkURL.Text.Length - 7) Else linkURL.Text = "https://www." & linkURL.Text.Substring(8, linkURL.Text.Length - 8) End If End If End If ElseIf (linkURL.Text.StartsWith("www.")) Then linkURL.Text = "http://" & linkURL.Text Else linkURL.Text = "http://www." & linkURL.Text End If End If
Dim req As HttpWebRequest = new HttpWebRequest.create(linkURL.Text)
Dim res As HttpWebResponse = req.GetResponse()
Dim src As String = New StreamReader(res.GetResponseStream()).ReadToEnd()
srcBox.Text = src srcBrowser.DocumentText = srcBox.Text
Private Function GetBetween(ByVal Source As String, ByVal Str1 As String, ByVal Str2 As String, Optional ByVal Index As Integer = 0) As String Return Regex.Split(Regex.Split(Source, Str1)(Index + 1), Str2)(0) End Function
Imports System.Text.RegularExpressions
Dim extracted As String = GetBetween(src, "I'm ", " Lucky") MsgBox(extracted)
Imports System.Net Imports System.IO Public Class Form1 Private Sub scrapeButton_Click(sender As Object, e As EventArgs) Handles scrapeButton.Click If (Not linkURL.Text = Nothing) Then linkURL.Text = linkURL.Text.ToLower() If (linkURL.Text.StartsWith("https://") Or linkURL.Text.StartsWith("http://")) Then If (Not linkURL.Text.StartsWith("https://www.") And Not linkURL.Text.StartsWith("http://www.")) Then If Not (linkURL.Text.StartsWith("www.")) Then If (linkURL.Text.StartsWith("http://")) Then linkURL.Text = "http://www." & linkURL.Text.Substring(7, linkURL.Text.Length - 7) Else linkURL.Text = "https://www." & linkURL.Text.Substring(8, linkURL.Text.Length - 8) End If End If End If ElseIf (linkURL.Text.StartsWith("www.")) Then linkURL.Text = "http://" & linkURL.Text Else linkURL.Text = "http://www." & linkURL.Text End If Dim req As HttpWebRequest = HttpWebRequest.Create(linkURL.Text) Dim res As HttpWebResponse = req.GetResponse() Dim src As String = New StreamReader(res.GetResponseStream()).ReadToEnd() srcBox.Text = src srcBrowser.DocumentText = srcBox.Text 'src End If End Sub End Class