Php HTTP Basics

Php Web Application
Php Email Codes
Php Array
Php Ifelse
Php variables
Php Substrings
Php Mysql Functions
php-sessions

Php HTTP Basics

When a web browser requests a web page, it sends an HTTP request
message to a web server. The request message always includes
some header information, and it sometimes also includes a body.
 The web server responds with a reply

 message, which always includes header information and usually
 contains a body. The first line of an HTTP request looks like this:
 GET /index.html HTTP/1.1 This line specifies an HTTP command,
 called a method , followed by the address of a document and the
 version of the HTTP protocol being used. In this case, the request
 is using the GET method to ask for the index.html

document using HTTP 1.1. After this initial line, the request can contain
optional header information that gives the server additional data about the request.
 For example: User-Agent: Mozilla/5.0 Windows 2000; U Opera 6.0 [en]
Accept: image/gif, image/jpeg, text/*, */*


The User-Agent header provides information about the web browser,
 while the Accept headerspecifies the MIME types that the browser
 accepts. After any headers, the request contains a blank line,
to indicate the end of the header section. The request can also
contain additional data, if that is appropriate for the method being
used . If the request doesn't contain any data, it ends with a blank line.
The web server receives the request,
processes it, and sends a response. The first line of an HTTP response
looks like this:
 HTTP/1.1 200 OK

 This line specifies the protocol version, a status code, and a description
 of that code. In this case, the status code is "200", meaning that the
 request was successful hence the description OK.

 After the status line, the response contains headers that give the client
additional information about the response. For example: Date: Sat, 26
 Jan 2002 20:25:12 GMT Server: Apache 1.3.22 Unix mod_perl/1.26
PHP/4.1.0 Content-Type: text/html Content-Length: 141 The
Server header provides information about the web server software,
 while the Content-Type header specifies the MIME type of the data
included in the response. After the headers, the response contains a
blank line, followed by the requested data, if the request was successful.
Related Posts:
  • php and pdf  Documents and Pages A PDF document is made up of a number of pages. Each page contains text and/or images.Put text onto  the pages, and send the pages back to the browser when you're done.    … Read More
  • What is difference between mysql_fetch_array(),mysql_fetch_row() and mysql_fetch_object() ? mysql_fetch_array():: fetches a result row as a associated array, numeric arraymysql_fetch_object: Fetaches a result row as object.mysql_fetch_row::fetches a result row as array … Read More
  • Declaring a Class To design your program or code library in an object-oriented fashion, you'll need to define your own classes, using the class keyword. A class definition includes the class name and the properties and methods of the clas… Read More
  • PHP Write and Read from File $fp = @fopen ("text1.txt", "r"); $fh = @fopen("text2.txt", 'a+'); if ($fp) { //for each line in file while(!feof($fp)) { //push lines into array $thisline = fgets($fp); $thisline1 = trim($thisline); … Read More
  • Use $_POST to get input values It will execute the whole file as PHP. The first time you open it,  $_POST['submit']  won't be set because the form has not been sent.    <?php if (isset($_POST['submit'])) { $example = $_POST['… Read More
  • XML Extensions in PHP 5 SimpleXML A new PHP 5-only extension that excels at parsing RSS files, REST results, and configuration data. If you know the document's format ahead of time, SimpleXML is the way to go. However, SimpleXML supports o… Read More
  • Sorting One Array at a Time PHP functions for sorting an array Effect Ascending Descending User-defined order Sort array by values, then reassign indices starting with 0 sort( ) rsort( ) usort( ) Sort array by values … Read More
  • P ARSING XML Two techniques are used for parsing XML documents in PHP:SAX(Simple API for XML) andDOM(Document Object Model). By using SAX, the parsergoes through your document and fires events for every start and stop tag orother element… Read More
  • Advanced SQL 15.1 Exploring with SHOW The SHOW command is useful for exploring the details of databases, tables, indexes, and MySQL. It's a handy tool when you're writing new queries, modifying database structure, creating repor… Read More
  • SELECTING DATA IN PHP You frequently select data in a MySQL table using PHP. Selecting data through a PHP programusing a MySQL command takes four steps:1. Make a connection to the database.2. Create a safe query with the command.3. Run the query.… Read More
  • PEAR class: System The System PEAR class is available as part of the basic PEAR install:<?phprequire_once "System.php";$tmp_file = System::mktemp();copy("http://php.net/robots.txt", $tmp_file);$pear_command = System::which("pear");?>PEAR… Read More
  • Encoding php file str_rot13() base64_decode()   Try ionCube PHP Encoder,  link - http://www.ioncube.com/sa_encoder.php        There are only two worthwhile players in the encoding market, Zend Guard ($600) and i… Read More
  • Storing Complex Data Types You can use sessions to store complex data types such as objects and arrays simply by treating them as standard variables, as this code shows: $myarr["0"] = "Sunday"; $myarr["1"] = "Monday"; $myarr["2"] = "Tue… Read More
  • How can we find the number of rows in a MySQL table? By Mysql SELECT COUNT(*) FROM table_name; … Read More
  • mysqli Fetch Methods If you prefer different MySQL fetch methods, they're also in mysqli. Given the same query of SELECT username FROM users, these example functions all print the same results: // Fetch numeric arrays: while ($row = mysqli_… Read More