dimanche 15 juillet 2018

Sending data to a client/browser from PHP script

I am beginning to learn web development and network programming again .(To be technically correct starting it again , as my past questions will also attest to an attempt being made early . So yes after a hiatus).

I am learning the basics of PHP for server side scripting .

So , I got it that in HTML forms , the name of every input corresponds to an entry in an array that the php script ,whose name is mentioned in "action" attribute , receives in the form of an hash-array from the environment when the server receives the request . Here the HTTP methods GET and POST come into play .

Now , having access to the array of input variables , the php script will do some manipulation or processing . Now it needs to send some output to be rendered by the browser or let's say it has decided to send few picture files to the browser. . What HTTP methods would it use to send these data to the browser ? How would the browser be aware of an incoming output from server ?

I know that this question has all it takes to elicit replies like " Take your time to learn all these stuffs " and "check this wikipedia link " but what I intend to have is the picture of a most fundamental or rudimentary website .

So , like the codes we have in the beginning of every OS development page of the most basic OS , or like the toy compilers in the beginning of every "how to write compiler" pages , I wanted to have the picture of a toy website , if it can be summed up in one html , and one client side script and one server side script( in this case ,written in PHP )

So , what will be a minimal PHP script that perfoms some operation on the inputs and sends some files or output to a server .

Like :

<?php
$player = $_POST['player'];
$team = $_POST['team'];

" Some http method".("some file name")

?>

So what to add to the above script in place of the some http method ?




Aucun commentaire:

Enregistrer un commentaire