Q:

PHP program to print the request method used to access the webpage

belongs to collection: PHP Miscellaneous

0

Here, we will use $_SERVER['REQUEST_METHOD'] superglobal to get the request method used to access the webpage.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program/Source Code:

The source code to print the request method used to access the webpage is given below. The given program is compiled and executed successfully.

<?php
//PHP program to print request method used 
//to access the webpage.

$RequestMethod = $_SERVER['REQUEST_METHOD'];

printf("Request Method: %s<br>", $RequestMethod);
?>

Output:

Request Method: GET

Explanation:

In the above program, we used $_SERVER['REQUEST_METHOD'] super global that returns the request method used to access the webpage, which is assigned to the variable $RequestMethod. After that, we printed the request method on the webpage.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

PHP Miscellaneous

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
PHP program to print the timestamp of the start of... >>
<< PHP program to print the server protocol...