Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#] GeoBytes IP Locator
16-07-2009, 02:15 PM,
Post: #1
[C#] GeoBytes IP Locator
[Image: o6s2fu7ej5wmcowd902p.gif]

Download:
[attachment=0]

Source Code

Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

namespace IP_Locator
{
    public partial class Form1 : Form
    {
        public string ip, postvalue, getdata;
        public Form1()
        {
            InitializeComponent();
            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ip = textBox1.Text;
            if (ip == null || ip == "" || ip == " ")
            {
                MessageBox.Show("Please Enter IP");
            }
            else
            {
                Thread th = new Thread(new ThreadStart(GetInformation));
                th.Start();
            }
        }

        public void GetInformation()
        {
            button1.Enabled = false;
            button1.Text = "WAIT";

            try
            {
                HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://www.geobytes.com/IpLocator.htm?GetLocation");

                rq.Method = "POST";
                postvalue = "ipaddress=" + ip + "";
                rq.ContentType = "application/x-www-form-urlencoded";
                rq.ContentLength = postvalue.Length;


                using (StreamWriter wr = new StreamWriter(rq.GetRequestStream(), System.Text.Encoding.ASCII))
                {
                    wr.Write(postvalue);
                }

                using (StreamReader sr = new StreamReader(rq.GetResponse().GetResponseStream()))
                {
                    getdata = sr.ReadToEnd();
                }

                Regex re = new Regex("name=\"(.*?)\" value=\"(.*?)\" size=\"(.*?)\"");
                MatchCollection mc = re.Matches(getdata);
                textBox2.Text = mc[0].Groups[2].Value;
                textBox3.Text = mc[1].Groups[2].Value;
                textBox4.Text = mc[2].Groups[2].Value;
                textBox5.Text = mc[3].Groups[2].Value;
                textBox6.Text = mc[10].Groups[2].Value;
                textBox7.Text = mc[11].Groups[2].Value;
                textBox8.Text = mc[15].Groups[2].Value;
                textBox9.Text = mc[19].Groups[2].Value;
            }

            catch (Exception)
            {
                /* Do Nothing */
            }
            button1.Enabled = true;
            button1.Text = "GO";
        }
    }
}


Attached Files
.zip   IP-Locator.zip (Size: 5,51 KB / Downloads: 67)
Reply
16-07-2009, 02:21 PM,
Post: #2
Re: [C#] GeoBytes IP Locator
nice one shime..

hoho..leh chck ip tu proxy atau x..

asl x letak ico?
Reply
16-07-2009, 03:39 PM,
Post: #3
Re: [C#] GeoBytes IP Locator
dia baru je belajar tu..
lum pro..
[Image: lude.jpg]

Reply
17-07-2009, 03:00 AM,
Post: #4
Re: [C#] GeoBytes IP Locator
works like a charm? Big Grin
ada example x
[Image: 3TUdC.png]
[Image: tbd2.png]

Behind this mask there is more than just flesh.
Beneath this mask there is an idea...
and ideas are bulletproof
.”
Reply
17-07-2009, 07:14 AM,
Post: #5
Re: [C#] GeoBytes IP Locator
Boogiboo Wrote:works like a charm? Big Grin
ada example x
example apa? :|

copy source code tu ke Mikelsop Virtual C#
tekan compile..
[Image: GteM3.png]
Reply


Forum Jump: