Tag: request

C#

How to make a Http Web Request properly using C#

//.. private HttpWebRequest _httpwebrequest; //..//.. private HttpWebRequest _httpwebrequest; //.. private void button1_Click(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(Test)); t.IsBackground = true; t.Start(); }private void button1_Click(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(Test)); t.IsBackground = true; t.Start(); } public void Test() { Dictionary<String, String> dict = new Dictionary<String, String>(); …

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++

Retrieve the User-Agent HTTP

ObtainUserAgentString retrieves the User-Agent HTTP request header string that is currently being used. //.. #pragma comment (lib, "urlmon.lib") //.. char httpUseragent[512]; DWORD szhttpUserAgent = sizeof(httpUseragent); ObtainUserAgentString( 0, httpUseragent, &szhttpUserAgent ); printf("%sn", httpUseragent); //..//.. #pragma comment (lib, "urlmon.lib") //.. char httpUseragent[512]; DWORD szhttpUserAgent = sizeof(httpUseragent); ObtainUserAgentString( 0, httpUseragent, &szhttpUserAgent ); printf("%sn", httpUseragent); //..

C#

Check if computer is alive with C#

To check if a computer in the network is alive we are going to ping it through C# and Ping class. Ping ping = new Ping(); PingReply pingReply; pingReply = ping.Send(ip, timeout); if (pingReply.Status == IPStatus.Success) { …. } else { …. }Ping ping = new Ping(); PingReply pingReply; pingReply = ping.Send(ip, timeout); if (pingReply.Status …

Javascript & Ajax

Performing GET and POST requests using Ajax

Ajax, Asynchronous JavaScript and XML, is not a programming language, is a group of technologies used on the client-side to send data to, or retrieve data from a server and update parts of a web page without reloading the whole page. Data is usually retrieved using the XMLHttpRequest object. JSON is often used instead of …

Javascript & Ajax

Performing GET and POST requests using Ajax

Let’s see a simple javascript method that uses XMLHttpRequest API and ActiveXObject(IE) to make HTTP GET and POST requests. function LoadDataInDiv(page, params, divid, method) { var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType(’text/html’); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) …

Apache, Linux

Securing Apache Part 1

The following tips are things you can do to make your apache server more secure. Before you begin to follow the tips below, locate your apache’s configuration files first. Common places for apache’s configuration files are: /etc/apache2/apache2.conf, /etc/apache2/httpd.conf and /etc/apache2/sites-enabled/000-default. Before you make any changes, MAKE BACKUP COPIES OF YOUR FILES. Here we go: 1. …