NSRequest - encode url for NSRequest POST Body (iPhone objectiive-C)
I am sending a post using NSRequest. 

 

    NSURL *url = [NSURL URLWithString:someUrlString];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]];
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]];


Within the body of the Request I am encoding the following NVP:

returnURL=http://someSite.com


The post is going through successfully, but I get an error back.
The error states an invalid url.

So, I changed it to:

returnURL=http:%2F%2FsomeSite.com

With the same error.

I have also double checked it with Todd Ditchendorf's HTTP CLient, with the same results.

I know I must be encoding this wrong can someone tell me what I am doing wrong?

Thanks 
Corey






NSRequest - encode url for NSRequest POST Body (iPhone objectiive-C)
===

I am sending a post using NSRequest. 

 

    NSURL *url = [NSURL URLWithString:someUrlString];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]];
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]];


Within the body of the Request I am encoding the following NVP:

returnURL=http://someSite.com


The post is going through successfully, but I get an error back.
The error states an invalid url.

So, I changed it to:

returnURL=http:%2F%2FsomeSite.com

With the same error.

I have also double checked it with Todd Ditchendorf's HTTP CLient, with the same results.

I know I must be encoding this wrong can someone tell me what I am doing wrong?

Thanks 
Corey





