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.
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.
Output:
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.