[Snippet] "Real IP"
First thing you need to do is create a php file
You can do this simply by opening your favorite document editor (notepad is good enouph)
Note:If you don't have a server you can get a free hosting server (php enabled) online, just search your favorite search engine and locate one.
If you don't want to go through the hassle, I have already uploaded it to my server, the information is in the module example displayed below
Add System.Net Reference From Reference Menu
Clicking the button should now generate your "Real Ip" in the label
Note: You can use ShowIP() pretty much in any control
You can have it displayed via msgbox , textbox, or anything else.
Hope this helps
You can do this simply by opening your favorite document editor (notepad is good enouph)
- Add this code to your open notepad
Code:
<?php echo $_SERVER['REMOTE_ADDR']; ?>
- Save it as myip.php
- Upload it to a (your) server.
Note:If you don't have a server you can get a free hosting server (php enabled) online, just search your favorite search engine and locate one.
If you don't want to go through the hassle, I have already uploaded it to my server, the information is in the module example displayed below
- Create a new VB Project.
- Add a New Module (You can do this by clicking Project --- Add Module in the toolbar)
- Add this code to the module
Add System.Net Reference From Reference Menu
Code:
Imports System.Net
Imports System.IO
Module Module1
Public Function ShowIp() As String
Dim uri_val As New Uri("http://innovatorsworldwide.com/MPGH/ip/myip.php")
Dim request As HttpWebRequest = HttpWebRequest.Create(uri_val)
request.Method = WebRequestMethods.Http.Get
Dim resp As HttpWebResponse = request.GetResponse()
Dim readr As New StreamReader(resp.GetResponseStream())
Dim myip As String = readr.ReadToEnd()
resp.Close()
Return myip
End Function
End Module
- Add a Button to the form.
- Add a Label to the form
- Add this code to your button click
Code:
Label1.Text = ShowIP()
Note: You can use ShowIP() pretty much in any control
You can have it displayed via msgbox , textbox, or anything else.
Hope this helps
TY
