I have URL which takes a parameter. In Firefox. I have download add-on and find the parameter for the request. I found PostData Tab on the httpFox add-on tool and I saw the parameter and value.
I created a string and added the parameter, and encoded that string value
NSString *parameterId = [NSString StringWithFormat:@"ac$2_sdrex_es34_4333f=Caa111"];
NSString EncodeID = [parameterId
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
...and created the PostData,
PostData = [encodeID dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
...and set the postLength,
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
...and set the http header values,
[request setValue:postLength forHttpHeaderField:@"Content-Length"];
[request setHTTPBody:postData];
and then make the connection,
connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
But this results in the following error...
Error Domain = NSURLErrorDomain code= -1002 unsupported url
I have encoded the URL too.
Can anyone advise me how to resolve this issue?
This is what after creating the postData!
NSURL *url = [NSURL URLWithString:urlString];
theRequest = [[NSMutableURLRequest alloc]initWithURL:url];
[theRequest setValue:@"win-eqjf1b1ep06:20000" forHTTPHeaderField:@"Host"];
[theRequest setValue:@"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10" forHTTPHeaderField:@"User-Agent"];
[theRequest setValue:@"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" forHTTPHeaderField:@"Accept"];
[theRequest setValue:@"en-us,en;q=0.5" forHTTPHeaderField:@"Accept-Language"];
[theRequest setValue:@"gzip,deflate" forHTTPHeaderField:@"Accept-Encoding"];
[theRequest setValue:@"ISO-8859-1,utf-8;q=0.7,*;q=0.7" forHTTPHeaderField:@"Accept-Charset"];
[theRequest setValue:@"115" forHTTPHeaderField:@"Keep-Alive"];
[theRequest setValue:@"keep-alive" forHTTPHeaderField:@"Connection"];
[theRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPBody:postData];
@all Thanks in advance