Tag: get

PHP

Getting visitors country from their IP

geoplugin geoPlugin is a free and easy webmaster resource to provide geolocation technology to your pages. $xml = simplexml_load_file(’http://www.geoplugin.net/xml.gp?ip=’.$visitor_ip_address);   foreach ($xml as $key => $value) { echo $key , ‘= ‘ , $value , ‘<br>’; }$xml = simplexml_load_file(‘http://www.geoplugin.net/xml.gp?ip=’.$visitor_ip_address); foreach ($xml as $key => $value) { echo $key , ‘= ‘ , $value , ‘<br>’; …

C#

Get public/external IP address in C#

1) Create a simple form with one button and one textbox. 2) Code private void button1_Click(object sender, EventArgs e) { ThreadStart starter = delegate { Request(); }; Thread thread = new Thread(starter); thread.Start(); }private void button1_Click(object sender, EventArgs e) { ThreadStart starter = delegate { Request(); }; Thread thread = new Thread(starter); thread.Start(); } public …

C++

HTTP POST and GET Requests with WinInet and C++

InternetOpenA InternetConnectA HttpOpenRequestA HttpSendRequestA InternetCloseHandle Method to make POST or GET requests: void Request(int Method, LPCSTR Host, LPCSTR url, LPCSTR header, LPSTR data) { try{ //Retrieve default http user agent char httpUseragent[512]; DWORD szhttpUserAgent = sizeof(httpUseragent); ObtainUserAgentString( 0, httpUseragent, &szhttpUserAgent );   char m[5];   if(Method == GET) strcpy(m, "GET"); else strcpy(m, "POST");   //http://msdn.microsoft.com/en-us/library/windows/desktop/aa385096%28v=vs.85%29.aspx …

C

Get Process ID by name

We are going to use the following functions: CreateToolhelp32Snapshot Process32First Process32Next CloseHandle Source #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <tlhelp32.h> #define INVALID_PID_VALUE -1;   DWORD GetProcessID( const char * processName );   int main(int argc, char* argv[]) { DWORD pid;   if(argc>1) { printf("rnSearching for the process id of ‘%s’ …rn", argv[1]);   pid …

C, C#

Get Active Window Title

Get Active Window Title in C: #include <windows.h> #include <stdio.h>   int main() { char title[256] = ""; HWND handle = GetForegroundWindow(); if (handle) { GetWindowText(handle, title, 256); printf("%srn",title); } else { printf("not foundrn"); } return 0; }#include <windows.h> #include <stdio.h> int main() { char title[256] = ""; HWND handle = GetForegroundWindow(); if (handle) { …