Hi im pretty much a total vb nub at the moment but im trying to learn. Anyway I've been trying to find out how i could load a random http proxy like 24.175.122.152:9090 from a txt file. I know how to load a random url but Im failing at doing this. Any help would be really appreciated :) Thanks

Anyway I've been trying to find out how i could load a random http proxy like 24.175.122.152:9090 from a txt file.

May I ask why you wish to do this... I'm hoping it is all strictly legal (a few friends have asked me about HTML proxies for illegal purposes and I refused to help them). I shall help you to read a random URL from a file though because then it is up to you what you choose to modify that to do.

I know how to load a random url but Im failing at doing this. Any help would be really appreciated :) Thanks

I'm assuming that because you know how to load a random URL that you only need to know how to read a random string from a file. That is what I intend to do with the next piece of code...

Dim randGen As New Random()
        Dim randNum As Integer
        Dim filePath As String = "textfile.txt"
        Dim fileReader As System.IO.StreamReader
        Dim randURL As String

        fileReader = New StreamReader(filePath)
        For i = 1 To randNum                      'Loop through to the random line replacing randURL each time until a random line in effect
            randURL = fileReader.ReadLine
        Next
        fileReader.Close()

I hope this helps to clear up your issue and sorry if I came across a bit strong to do with what you may be using this code for it is just a topical issue that we all need to be careful about.
ParkeyParker

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.