HTTP Tips & Tutorials

Make Firefox to Not Send HTTP Referer (or On a Per-Site Basis)

By default browsers such as Firefox sends the Referer information to the target URL in the HTTP header, as defined by HTTP protocol, so the destination URL / website knows where you have come from. For instance, when you click this link to one of my friends’ sites, it would know you have arrived at …

Make Firefox to Not Send HTTP Referer (or On a Per-Site Basis) Read More »

Redirect 404 Error to Home Page

Other than making your 404 error page user friendly, you can redirect it to your index pages such as the homepage, sitemap, or search page, to make it useful for the users. Instead of relying on them to correct the error themselves, you offer the new orientation. How to redirect a 404 error page to …

Redirect 404 Error to Home Page Read More »

HTML: Make a Page Refresh Every xx Seconds

A quick tip for those who just started learning HTML. It’s possible to add a line of code in your HTML page so that it’s automatically refreshed every few seconds when loaded in the user’s browser. To make the page automatically refresh itself every 60 seconds, just insert the following code in the <head></head> section …

HTML: Make a Page Refresh Every xx Seconds Read More »

PHP: How to distinguish values in $_POST or $_GET that are sent via HTTP requests and those that are set / assigned in the code

To send parameters to a PHP script, you can either fabricate a form and post a few variables by the POST method or simply send a request of a URL full of GET value pairs. This way, in the server side PHP script code, you can retrieve these parameters sent from the client in $_POST …

PHP: How to distinguish values in $_POST or $_GET that are sent via HTTP requests and those that are set / assigned in the code Read More »

PHP: How to detect / get the real client IP address of website visitors?

It may seem simple at first because most of us should be relying on the server side environmental variable REMOTE_ADDR solely for client IP addresses: echo $_SERVER[‘REMOTE_ADDR’]; Yet it’s barely enough to get the real IP for a variety of circumstances such as when the user is visiting your website from a proxy server. To …

PHP: How to detect / get the real client IP address of website visitors? Read More »

2 reasons you should host all static content on a different domain

That is, to host all static content such as ready-made images, scripts, style sheets on a different domain rather than the primary one that hosts the page of the current URL. For example, if you intend to add static images to the web page located at http://www.example.com/page.html, you should not place the images on www.example.com, …

2 reasons you should host all static content on a different domain Read More »

scp, rsync: Transfer Files between Remote Servers via SSH

Chances are you have a bunch of different hosts that are housing your website files, for the sake of data safety (never put all eggs in a single basket) and possibly some SEO advantage. If that is the case, you will infrequently come to the need to move some files from one host server to …

scp, rsync: Transfer Files between Remote Servers via SSH Read More »

Apache, PHP: Get Client Browser HTTP Request Headers Information

Every HTTP requests made by any client web browsers to an Apache should conform to the HTTP specification and provide certain set of headers information for the server to parse and understand. Useful headers information that can be retrieved in PHP by function apache_request_headers() includes: User-Agent: Operating System, browser and its version number, … Accept-Language: …

Apache, PHP: Get Client Browser HTTP Request Headers Information Read More »

PHP: Send HTML Email (mail)

As we all know the simplest approach to create an email message and send it out is to use the php mail() function. A typical usage example would be: mail(‘[email protected]’, ‘Subject Title’, ‘Message body goes here.’); However, as the mail() function sends emails in text/plain mime type by default, if you include HTML code in …

PHP: Send HTML Email (mail) Read More »

PHP cURL: Fetching URL and Sending Request with Cookies

One of the things the remote web server inspects is the client cookie to know about the requester. If you need cURL to simulate a user browser that sends cookie information to the web server, you need the following options: $c = curl_init(‘http://www.example.com/needs-cookies.php’); curl_setopt ($c, CURLOPT_COOKIE, ‘user=ellen; activity=swimming’); curl_setopt ($c, CURLOPT_RETURNTRANSFER, true); $page = curl_exec …

PHP cURL: Fetching URL and Sending Request with Cookies Read More »

PHP cURL: Making POST Request to URL

By default, all HTTP requests made out by cURL is GET requests that simply fetches the URL and don’t submit any more POST variables. However, if you need to fetch and retrieve URL by the POST method with cURL, you need the snippet below: $url = ‘http://www.example.com/submit.php’; // The submitted form data, encoded as query-string-style …

PHP cURL: Making POST Request to URL Read More »

HTTP Explained: What Does HTTP Stand For, What is HTTP Meaning and HTTP’s Definition?

What is HTTP in all the web site URLs / web page addresses you see everywhere online? HTTP Explained: Just like people communicate with each other following certain protocols, HTTP is the protocol between the client (your computer using web browsers) and the server (web server serving web pages and similar online resources). So what …

HTTP Explained: What Does HTTP Stand For, What is HTTP Meaning and HTTP’s Definition? Read More »

Free Online Visual Trace Route Tool

Trace route (command) is a common network diagnostic tool to debug network problems or check how data is passed through the whole network through all different kinds of computers, routers and such. A visual trace route tool, however, draws the data passage in illustrative diagrams or on a map for visionary perception graphically. You Get …

Free Online Visual Trace Route Tool Read More »

Which is better for AJAX requests, GET or POST?

As per HTTP protocol specifications, client browsers send http post requests in two-step processes: 1) send the headers, 2) send the data. Therefore, for websites with high volume traffic, it’s definitely preferable to choose GET method for AJAX requests over HTTP, because all it takes for GET to get out is a URL request, which …

Which is better for AJAX requests, GET or POST? Read More »