NSMutableURLRequest POST string data with URLencode, return “414 Request-URI Too Large"
When I use NSMutableURLRequest to POST string data with URLencode, return “414 Request-URI Too Large”,How I can do? return error message as below:
<html>
<head><title>414 Request-开发者_JAVA技巧URI Too Large</title></head>
<body bgcolor="white">
<center><h1>414 Request-URI Too Large</h1></center>
<hr><center>nginx/1.0.6</center>
</body>
</html>
and I use NSMutableURLRequest Setting as below:
NSURL *url = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[urlStr dataUsingEncoding:NSUTF8StringEncoding]];
urlstr cannot be both URL and POST data. You must split it at the ? or the first & into URL and POST data.
精彩评论