1

I am wondering what the difference between Get and Post with asihttprequest library..

Is this a GET?

- (IBAction)sendHttpsRequest
{    
    //Set request address
    NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"https://142.198.16.35"];

    //call ASIHTTP delegates (Used to connect to database)
    NSURL *url = [NSURL URLWithString:databaseURL];

    //This sets up all other request
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

    [request setDelegate:self];
    [request startAsynchronous];
}

is a post when you try to set elements say within a php document? any examples would be awesome!

C.Johns
  • 10,107
  • 18
  • 99
  • 155

2 Answers2

3

http://www.cs.tut.fi/~jkorpela/forms/methods.html

An HTTP GET is a request from the client to the server, asking for a resource.

An HTTP POST is an upload of data (form information, image data, whatever) from the client to the server.

What you have there is an HTTP POST.

-EDIT:

Per http://allseeing-i.com/ASIHTTPRequest/: ASIFormDataRequest

A subclass of ASIHTTPRequest that handles x-www-form-urlencoded and multipart/form-data posts. It makes POSTing data and files easy, but you do not need to add this to your project if you want to manage POST data yourself or don’t need to POST data at all.

My bad, this one was a POST, not a GET. The rest of my answer was valid, though :)

Chaosphere2112
  • 634
  • 6
  • 18
  • Thank you, I thought that was the case but just wanted to make sure.. because I just don't trust myself.. will commit that to memory and give you the tick of approval once the wait period is over.. thank you very much :) – C.Johns Dec 06 '11 at 00:04
  • I actually got what your request was wrong... you should probably give the answer to the guy below me :) – Chaosphere2112 Dec 06 '11 at 00:18
1

That is a POST request, which is the default for ASIFormDataRequest. The difference is the same as it would be in a normal HTTP request. You can read about that here if you don't already know.

In general, if you are just downloading a web page and do not need to send any variables to the server, a GET request is sufficient. If you want to send variables in your request, often times a POST request is the way to go since it is a bit more secure and less transparent.

Michael Frederick
  • 17,057
  • 3
  • 41
  • 57