• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do you append the data to the URL while POSTING?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you append the data to the URL while POSTING?


  • Subject: Re: How do you append the data to the URL while POSTING?
  • From: Conor Dearden <email@hidden>
  • Date: Sat, 04 Nov 2006 17:44:35 +0100

>  1) How do you append the data to the URL while POSTING?
>
>  2)How do you receive a response Data from the server?
>
>  3) I have seen a code to parse an XML.
>  But I don't see any to create an XML. I need to know how to create an XML
> file .

The following should give you a place where to start digging into the Cocoa
documentation: (Written in Mail could have typos).

  NSMutableURLRequest* postRequest = [NSMutableURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.YourServer.com/post.php";]];
    [postRequest setHTTPMethod: @"POST"];

    NSString *bodyOfPost = @"language=Cocoa&User=Me";
    [postRequest setHTTPBody: [bodyOfPost dataUsingEncoding:
NSISOLatin1StringEncoding]];

    NSURLConnection *theConnection = [[[NSURLConnection alloc]
initWithRequest: postRequest delegate:self] autorelease];

// Send the post and get a response
// This can be done asynchronous but that is more complicated
    NSString *XMLResponse = [[[NSString alloc] initWithData:[NSURLConnection
sendSynchronousRequest: postRequest returningResponse:nil error:nil]
encoding:NSISOLatin1StringEncoding] autorelease];

    // Use NSXMLDocument to parse the data or do it by hand with NSScanner

Regards,
Conor
http://www.bruji.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How do you append the data to the URL while POSTING? (From: dee gee <email@hidden>)

  • Prev by Date: NSPredicate behavior with different stores (CONTAINS vs. LIKE)
  • Next by Date: Re: What all is Cocoa used for?
  • Previous by thread: Re: How do you append the data to the URL while POSTING?
  • Next by thread: Re: What all is Cocoa used for?
  • Index(es):
    • Date
    • Thread