I have been using preg_match_all
from URL's where we can fetch data using GET
method, but how do I get data using POST
method.
In my case, I want to fetch PNR details from http://www.indianrail.gov.in/pnr_Enq.html (which is a form that posts data) and fetch all required details. I know form post using jQuery
but how do I go about using preg_match_all
in PHP?
PHP does this for you and presents you all variables available from HTTP request in the form of superglobals: http://php.net/manual/en/reserved.variables.get.php
In your case there's $_POST
superglobal array which contains all variables parsed from current HTTP POST
request: http://php.net/manual/en/reserved.variables.post.php