title: How can I get the jobs url from my search on indeed.com in visual basic
body: <p>I have tried to get links from a search. </p>
  
  <p>I first tried this...</p>
  
  <pre><code>Private Sub GetDocumentLinks()
      Try
          If (WebBrowser1.Document IsNot Nothing) Then
              With WebBrowser1.Document
                  For Each Items As HtmlElement In WebBrowser1.Document.Links
                      'lstLinks.Items.Add(Items.GetAttribute("HREF").ToString())
                  Next
              End With
          End If
      Catch ex As Exception
          MessageBox.Show(ex.Message.ToString(), "Info")
      End Try
  End Sub
  </code></pre>
  
  <p>I have written a new code to search for links with an request. Getting the links is not the issue, redirected is. The strange this is... When I m copy the link in to my browser right page is displayed. Soo why doesn't work that in my request? I have try to limit the redirect, but when there are more redirects, it returns with error.</p>
  
  <pre><code>Public Sub ParsingIndeed()
          Dim IntNextpage As Integer = 0
  
          Do While urlNavigate &lt;&gt; ""
              Dim document As New HtmlAgilityPack.HtmlDocument
              Dim myHttpWebRequest = CType(WebRequest.Create(urlNavigate), HttpWebRequest)
              myHttpWebRequest.UserAgent = "Mozilla/5.0 (compat ble; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
  
              Dim streamRead = New StreamReader(CType(myHttpWebRequest.GetResponse(), HttpWebResponse).GetResponseStream)
              Dim res As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
              document.Load(res.GetResponseStream(), True)
  
              Dim node As HtmlNode = document.GetElementbyId("resultsCol") 'id="resultsCol zoeken op indeed.com
  
              Dim TList As New ArrayList
  
              For Each noteA As HtmlNode In node.SelectNodes("//a[@onclick]") '("//a[@Data-tn-element]")
  
                  Dim findstring = noteA.Attributes("onclick").Value
  
                  If InStr(findstring, "setRefineByCookie([&amp;#039;radius") &lt;&gt; 0 Then
                      Dim href = noteA.Attributes("href").Value
                      'MsgBox(href)
                      If Not String.IsNullOrEmpty(href) Then TList.Add("http://be.indeed.com" &amp; href)
                  End If
              Next
              ReDim Preserve StrLinkArray(0)
              ConvertArraylistToString(TList, StrLinkArray)
              ArraySplitOnSpacesAndFiterEmpty(StrLinkArray)
              RemoveDuplicatesArray(StrLinkArray) 'dit zijn alle linken die we gevonden hebben
  
              For Each noteA As HtmlNode In node.SelectNodes("//a[@href]")
  
                  Dim href = noteA.Attributes("href").Value
  
                  If Not String.IsNullOrEmpty(href) Then TList.Add("http://be.indeed.com" &amp; href)
              Next
              ReDim Preserve StrUrlVolgende(0)
              ConvertArraylistToString(TList, StrUrlVolgende)
              ArraySplitOnSpacesAndFiterEmpty(StrUrlVolgende)
              RemoveDuplicatesArray(StrUrlVolgende)
  
              IntNextpage = IntNextpage + 10
              FilterUsefullStringsArray(StrUrlVolgende, "start=" &amp; IntNextpage)
  
              If StrUrlVolgende.Length &lt;&gt; 0 Then
                  urlNavigate = StrUrlVolgende(0)
              Else
                  urlNavigate = ""
              End If
  
              For intteller As Integer = 0 To UBound(StrLinkArray)
  
                  Try
  
                      document = New HtmlAgilityPack.HtmlDocument
                      myHttpWebRequest = CType(WebRequest.Create(StrLinkArray(intteller).ToString), HttpWebRequest)
  
                      myHttpWebRequest.UserAgent = "Mozilla/5.0 (compat ble; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
  
                      streamRead = New StreamReader(CType(myHttpWebRequest.GetResponse(), HttpWebResponse).GetResponseStream)
  
                      res = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
  
                      document.Load(res.GetResponseStream(), True)
  
                  Catch ex As Exception
                      MessageBox.Show(ex.Message.ToString(), "", MessageBoxButtons.OK)
                  End Try
              Next
          Loop
  end sub
  </code></pre>