Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9267807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:38:36+00:00 2026-06-18T14:38:36+00:00

Hey guys well my idea is simple, I will get location information from an

  • 0

Hey guys well my idea is simple, I will get location information from an IP address (proxy at example) with Utrace API.

look at this code (thanks google)

public static string GetLocation(string IP)
    {
        var location = "";
        List<string> HTML_code = new List<string>();
        WebRequest request = WebRequest.Create("http://xml.utrace.de/?query=" + IP);
        using (WebResponse response = request.GetResponse())
        using (StreamReader stream = new StreamReader(response.GetResponseStream()))
        {
            string line;
            while ((line = stream.ReadLine()) != null)
            {
                HTML_code.Add(line);
            }
        }
        location = (HTML_code[296].Replace("<td><font size=\"-1\">", "")).Replace("</font></td>", "");
        return location;
    }

OK but the output from the utrace API is the following:

  <?xml version="1.0" encoding="iso-8859-1"?>
    <results>
    <result>
    <ip>188.40.16.134</ip>
    <host></host>
    <isp>Hetzner Online AG Pagedesign</isp>
    <org>Hetzner Online AG Pagedesign</org>
    <region>Koblenz</region>
    <countrycode>DE</countrycode>
    <latitude>50.349998474121</latitude>
    <longitude>7.5999999046326</longitude>
    <queries>8</queries>
    </result>
    </results>

My XML skill is not the best I hope you guys can help me to edit this line:

location = (HTML_code[296].Replace("<td><font size=\"-1\">", "")).Replace("</font></td>", "");

I will an output like this:

Hetzner Online AG Pagedesign : Koblenz

and not

<?xml version="1.0" encoding="iso-8859-1"?>
    <results>
    <result>
    <ip>188.40.16.134</ip>
    <host></host>
    <isp>Hetzner Online AG Pagedesign</isp>
    <org>Hetzner Online AG Pagedesign</org>
    <region>Koblenz</region>
    <countrycode>DE</countrycode>
    <latitude>50.349998474121</latitude>
    <longitude>7.5999999046326</longitude>
    <queries>8</queries>
    </result>
    </results>

Thanks in advance for your help

Edit:

My new code is following:

public static void getloc(string ip)
    {
        var location = "";
        var wc = new WebClient();
       location = wc.DownloadString("http://xml.utrace.de/?query=" + ip);
       location = location.Replace("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>", "").Replace("<results>", "").Replace("<result>", "")
           .Replace("<ip></ip>", "").Replace("<org></org>", "").Replace("<latitude></latitude>", "").Replace("<longitude></longitude>", "").Replace("<queries>*</queries>", "")
            .Replace("</result>", "").Replace("</results>", "");  
        Console.WriteLine(location);
    }

the output is then :

<ip>212.19.62.76</ip>
<host>1</host>
<isp>Plus.line AG</isp>
<org>ANW GmbH &amp; Co. KG</org>
<region>Bechhofen</region>
<countrycode>DE</countrycode>
<latitude>49.150001525879</latitude>
<longitude>10.550000190735</longitude>
<queries>6</queries>

How can I get an output like
Plus.line AG ANW GmbH & Co. KG Bechhofen

Greets and thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:38:38+00:00Added an answer on June 18, 2026 at 2:38 pm

    Load the XML into an XmlDocument and parse it properly.

    public static void getLoc(string ip)
    {
        var wc = new WebClient();
        string location = wc.DownloadString("http://xml.utrace.de/?query=" + ip);
    
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(location);
    
        XmlNode orgNode = doc.SelectSingleNode("//org/text()");
        XmlNode regionNode = doc.SelectSingleNode("//region/text()");
    
        return String.Format("{0} {1}", orgNode.Value, regionNode.Value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Hey guys im trying to get a simple button masher up, What i want
hey guys having this really simple problem but cant seem to figure out have
Hey guys, im not well versed in dealing with asynchronous design patterns, and im
Hey guys I wanted to know if i could get a little help: Im
Hey guys I have an absolute position for an element that will be created
Hey guys. This is a follow-on from this question : After getting the right
Hey guys, I am a little confused as to how to get the T4
Hey guys, is it true that all the process/thread scheduling will be disabled if
Hey guys, here's my requirement: I have one central App which receives requests from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.