Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Mini IP Tool problem with Geo IP

Whats Up,

i have a Problem with my code.

i have a textbox to enter an ip then one for the output and a Button to Start.

the Code looks like this:

Code
Private Sub geoip_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles geoip.KeyDown
        If e.KeyCode = Keys.Enter Then
            e.SuppressKeyPress = True
            geoausgabe.Text = ""
            WebRequest.Create("www().api.()com/()()geoip.Text)
            geoausgabe.Text = New System.Net.WebClient().DownloadString("www().api.()com/()()geoip=" + geoip.Text)

the output of the api is in a HTML Format, so the output text has <br> in it.

is there a way to transform the <br> into next line (\n) that the output is orderd :D


Thanks..


ps: i will publish my Programm. It has a Skype Resolver and other cool tools in it :D
(Nov 20, 2015 05:15 AM)BigMre Wrote:  
Code
WebRequest.Create("www().api.()com/()()geoip.Text)
geoausgabe.Text = New System.Net.WebClient().DownloadString("www().api.()com/()()geoip=" + geoip.Text)

You're gonna have to pick one.

As for your question, easy way is to call Replace and replace "<br />" or whatever with string.Empty.
öhm i have a api.. i just censored it.


but i do not really know how to do this
(Nov 20, 2015 05:47 AM)BigMre Wrote:  öhm i have a api.. i just censored it.


but i do not really know how to do this

holy shit, string manipulation is something that you learn 101 style, not a fucking skype, ip, web anything.

this is VERY VERY VERY basic.
Hoping that other less novice programmers stumble upon this thread in the future, I'll post something I made a while back for another user on here.

[Image: ZtOVvV3.png]

Example using the API provided by https://freegeoip.net

[Image: 3ANqP5w.png]
(Nov 20, 2015 07:36 AM)log dot zip Wrote:  Hoping that other less novice programmers stumble upon this thread in the future, I'll post something I made a while back for another user on here.

-snip

Or copy the response, go to VS and Edit -> Paste Special -> Paste XML As Classes, then deserialize if you want everything:

Code
var ip = Console.ReadLine();

Response response = null;
var serializer = new XmlSerializer(typeof(Response));
            
using (var wc = new WebClient())
using (var sr = new StringReader(wc.DownloadString($"https://freegeoip.net/xml/{ip}")))
    response = (Response)serializer.Deserialize(sr);

Console.WriteLine(response.CountryName);
Console.ReadLine();

If you're printing everything, override ToString and build it there.
turn option strict on
it always catches those weird errors


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by DASKJul 18, 2019 03:03 AM 1 152 Jul 18, 2019 03:03 AM
Last Post: Skofos
[.NET] by silver_shineSep 19, 2018 06:25 AM 3 222 Sep 19, 2018 06:25 AM
Last Post: th3s3cr3t0n3
[.NET] by XoggDec 10, 2016 10:40 AM 5 312 Dec 10, 2016 10:40 AM
Last Post: Xogg