Good afternoon guys,
This is the first time I post in this forum, I'm normally in Security, but Need some help with this code.
First let me explain what I'm trying to do:
I'm basically trying to go to a website and gather basic data from a webpage and then output it as required. Currently using listboxes but would like list box plus csv.
Currently here is what I have (its truncated for easier reading)
#note im using Visual Studio Community
1) Added the following "using statements"
In my script I have something like this:
WebClient web = new WebClient();
String html = web.DownloadString ("http://www.ipvoid.com/scan/126.96.36.199/");
MatchCollection m1 = Regex.Matches(html, @"IP Address.*<strong>(.+?)<\/strong>", RegexOptions.Singleline);
#Note this part has me concerned of resources (aka i think it might be doing a loop but it is what i found on the internet see link bellow#
foreach (Match m in m1)
string IP = m.Groups.Value;
listBox1.DataSource = IPs;
Now what I would like to do that I'm having issues with due to lack of practice or complexity in the troubleshooting to get it to work is the following:
1) my current setup works only for 1 webpage.
I would like to have an txt and feed that in a loop EG:
String html = web.DownloadString ("http://www.ipvoid.com/scan/"variablefromtxt"/");
so if my txt has 1, 2, 3, 4 etc it will look like
then gets the IP
then gets the IP
etc until there are no longer values in the txt.
2) not sure if theres a more efficient way to do this since values are not repeated like in the video file i used as reference EG: the whole "foreach" statemnt might be irrelevant for this code
other thing i would like it to do is to export to a CSV but it is not as critical as the other thing
I'm using this youtube video as reference:
*Note: im currently gathering several inputs not just 1. This is not school work, homework, nor a project, it just me learning and trying to use it for real life examples.