none
how to get text from web using http request RRS feed

  • Question


  • hi guys.. i need get this text 

    and display him in TextBox

    link:

    http://www.ngoao.gov.iq/default.aspx

    Tuesday, October 10, 2017 4:27 PM

All replies

  • Hi KORG.Pa3x,

    You want to get some content from webpages using httprequest, I suggest you use the following code to try, but I get nothing using the link you provide, is this URL encrypted or not allowed to download? Because I get some content using other webpages URL.

     Dim html As String = String.Empty
            Dim url As String = "http://www.ngoao.gov.iq/default.aspx"
    
            Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
            Using response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
                Using stream As Stream = response.GetResponseStream()
                    Using reader As New StreamReader(stream)
                        html = reader.ReadToEnd()
                    End Using
                End Using
            End Using
    
            Console.WriteLine(html)

    The using Regex to get some content that you want to get, like this:

    https://stackoverflow.com/questions/21087809/display-particular-part-of-website

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 11, 2017 6:47 AM
    Moderator
  • Hi KORG.Pa3x,

    You want to get some content from webpages using httprequest, I suggest you use the following code to try, but I get nothing using the link you provide, is this URL encrypted or not allowed to download? Because I get some content using other webpages URL.

     Dim html As String = String.Empty
            Dim url As String = "http://www.ngoao.gov.iq/default.aspx"
    
            Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
            Using response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
                Using stream As Stream = response.GetResponseStream()
                    Using reader As New StreamReader(stream)
                        html = reader.ReadToEnd()
                    End Using
                End Using
            End Using
    
            Console.WriteLine(html)

    The using Regex to get some content that you want to get, like this:

    https://stackoverflow.com/questions/21087809/display-particular-part-of-website

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    not work dude :/
    Wednesday, October 18, 2017 3:09 PM