1

I'm trying to parse xml but I have a problem:

NSString *url = [NSString stringWithFormat:@"http://ipadress/web_service/list.php?DATE=%@",dateSinc];
NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];

NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (conn) {
    webData = [[NSMutableData data] retain];
}
else{

}

when the dateSinc is 2013-02-04 example it works but when is 2013-02-04 09:47:00 it doesn't work(the connection not respond)... but in browser works..

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
Ladessa
  • 985
  • 4
  • 24
  • 50

1 Answers1

2

I think the issue relates to not properly encoding the URL, so the web server isn't seeing the date you want:

NSString *url = [NSString stringWithFormat:@"http://ipadress/web_service/list.php?DATE=%@",dateSinc];
NSString *encodedURL = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:encodedURL]];
// etc.
Sumit Mundra
  • 3,891
  • 16
  • 29
trojanfoe
  • 120,358
  • 21
  • 212
  • 242