I'll be nice to have it in FiveWin:
- Code: Select all Expand view
- // IP WAN address PHP script access with C/C++ on Windows OS
// http://show-ip.net/mini/
//
// getip.c
// cl getip.c wininet.lib user32.lib
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
char output[16];
char getipurl[30] = "http://getip.110mb.com/mini/";
// char getipurl[45] = "http://getip.110mb.com/mini/index.php?v=ahp";
// adjust ReadSize value
int GetIP(char *url)
{
HINTERNET hInternet;
HINTERNET hFile;
DWORD ReadSize;
BOOL bResult;
hInternet = InternetOpen(
"Some USER-AGENT",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0);
hFile = InternetOpenUrl(
hInternet,
url,
NULL,
0,
INTERNET_FLAG_RELOAD,
0);
ReadSize = 15;
bResult = InternetReadFile(
hFile,
output,
15,
&ReadSize);
output[ReadSize] = '\0';
printf("\n IP: %s\n", output);
InternetCloseHandle(hFile);
InternetCloseHandle(hInternet);
return 0;
}
int main()
{
GetIP(getipurl);
return 0;
}
a zip file with .EXE and .C can be found here:
http://show-ip.net/download/getip/getip.zip