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 file and paste this in it:

<?php

echo $_SERVER['REMOTE_ADDR'];

?>

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

In your project create a .

Declare the imports section at the very top

Imports System.Net

Imports System.

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'];
?>

Tags: , , , ,



Leave a Comment

Anti-Spam Protection by WP-SpamFree