I saw this post @ stackoverflow.com, I was trying to do the same. So I thought I’d post a complete solution. See this link above or the code below

To Combine the answers above”

Create a php file and paste this in it:

<?php

echo $_SERVER['REMOTE_ADDR'];

?>

save it as curip.php and upload it to your server.

In your VB.net project create a module.

Declare the imports section at the very top

Imports System.Net

Imports System.IO

And create your function:

Public Function GetIP() As String

Dim uri_val As New Uri(“http://yourdomain.com/curip.php”)

Dim request As HttpWebRequest = HttpWebRequest.Create(uri_val)

request.Method = WebRequestMethods.Http.Get

Dim response As HttpWebResponse = request.GetResponse()

Dim reader As New StreamReader(response.GetResponseStream())

Dim myIP As String = reader.ReadToEnd()

response.Close()

Return myIP

End Function

Now anywhere in your code you can issue

Dim myIP = GetIP()

and use the value from there as you wish.

<?php
echo $_SERVER['REMOTE_ADDR'];
?>

Share and Enjoy:
  • Digg
  • Slashdot
  • del.icio.us
  • StumbleUpon
  • Twitter
  • Facebook
  • MySpace
  • Technorati
  • Mixx
  • ThisNext
  • Google Bookmarks
  • Live
  • Current
  • FriendFeed
  • PDF
  • email
  • Print
  • Tumblr
  • LinkedIn
  • Suggest to Techmeme via Twitter
  • Reddit
  • Ping.fm
Related posts:

Tags: , , , ,



Leave a Comment

CommentLuv Enabled

Anti-Spam Protection by WP-SpamFree