øh?
jeg skulle ha fat i ip\'en ...!
den skriver på intet tidspunkt ip\'en.. (din EGEN ip)
anyways, så har jeg selv fundet en løsning..
i en PHP-fil skriver man følgende:
<?
function getip() {
$IP = $GLOBALS[\'REMOTE_ADDR\'];
$FIP = $GLOBALS[\'HTTP_X_FORWARDED_FOR\'];
if (($FIP != \"\") && ($FIP != \"unknown\")) $IP = $FIP;
$IP = explode(\",\", $IP);
$IP = $IP[0];
return $IP;
}
echo getip();
?>
og så uploader man den til en server der understøtter php..
man kalder den fx. ip.php ...
Så laver man et module i VB og skriver følgende:
Public Declare Function GetTempPath Lib \"kernel32.dll\" Alias \"GetTempPathA\" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Declare Function GetTempFileName Lib \"kernel32.dll\" Alias \"GetTempFileNameA\" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Declare Function URLDownloadToFile Lib \"urlmon\" Alias \"URLDownloadToFileA\" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function GetIp(toFile)
Dim GotIP
URLDownloadToFile 0, \"
http://www.url.til.hp.dk/ip.php\", toFile, 0, 0
Open toFile For Input As #1
Line Input #1, GotIP
Close #1
GetIp = GotIP
End Function
så i en form (en button) skriver man dette:
Private Sub Command1_Click()
Dim tempfile As String \' receives name of temporary file
Dim lastfour As Long \' receives hex value of the randomly assigned ????
tempfile = Space(255) \' initialize buffer to receive the filename
lastfour = GetTempFileName(GetTemp, \"api\", 0, tempfile) \' get a unique temporary file name
\' (Note that the file is also created for you in this case.)
tempfile = Left(tempfile, InStr(tempfile, vbNullChar) - 1) \' extract data from the variable
MsgBox \"Your IP is detected to be: \" & GetIp(tempfile), vbYesNo, \"Detection of IP\"
End Sub
... :O)
så din virker desværre ikke :(