Solved

POST / GET ???  what's the difference

Posted on 1998-08-15
5
129 Views
Last Modified: 2013-12-25
Could someone tell me what's the difference between POST and GET with an example for each please?
0
Comment
Question by:fleal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 7

Accepted Solution

by:
jconde earned 200 total points
ID: 1827420
The difference between post and get is basically the way the parameters to the cgi are passed by.

while get reads the QUERY_STRING ambient variable, POST reads the standard input.

ej:

#include <stdio.h>

void main()
{
  char *cl;
  cl = getenv("QUERY_STRING");
  puts ("Content-Type:  text/html\n");
  printf ("%s",cl);
}

this example will print something like:
first=first+parameter&second=second+parameter.......
where first and second are the names of the controls you set in your form.

using post would be something like this:

#include <stdio.h>
void main()
{
char a[100];
printf ("Content-type: text/html\n\n");
fgets(a, 100, stdin);
printf ("%s",a);
}
this example will have the same output as the first.

with get, you can only send a few parameters to the cgi.  Thus makeing it unstable at some point.

with POST you override that problem.


--jconde
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827421
Which one of those do you recommend for a simple search engine that will be using 6 parameters at the most?
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827422
It doesnt matter! fleal, but try using post!
0
 

Author Comment

by:fleal
ID: 1827423
Jconde,

I not be using 6 parameters.  I will be coding a shopping cart and there will be more than 6 parameters.

fleal.
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827424
Ok, then you should consider using COOKIES instead!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question