Solved

POST / GET ???  what's the difference

Posted on 1998-08-15
5
124 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
  • 4
5 Comments
 
LVL 7

Accepted Solution

by:
jconde earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
It doesnt matter! fleal, but try using post!
0
 

Author Comment

by:fleal
Comment Utility
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
Comment Utility
Ok, then you should consider using COOKIES instead!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now