2552/11/16

Get XML from a URL

- (NSString *)getBusXMLAtStop:(NSString *)stopNumber
{
NSError *error;
NSURLResponse *response;
NSData *dataReply;
NSString *stringReply;

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
[NSURL URLWithString: [NSString stringWithFormat:@"http://avlweb.charlottesville.org/RTT/Public/RoutePositionET.aspx?PlatformNo=%@&Referrer=uvamobile", stopNumber]]];
[request setHTTPMethod: @"GET"];
dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
stringReply = [[NSString alloc] initWithData:dataReply encoding:NSUTF8StringEncoding];
NSLog(stringReply);
return stringReply;
}
Powered By Blogger