Getting NSData from a URL works in the simulator but not on a device


I implement a method that send notes to the server:


    NSString *strurl=[NSString stringWithFormat:@"http://localhost/get-data/insert.php?Name=%@&message=%@",txtf.text,txt2.text];
    NSData *dataurl=[NSData dataWithContentsOfURL:[NSURL URLWithString:strurl]];
    NSString *stresult=[[[NSString alloc]initWithData:dataurl encoding:NSUTF8StringEncoding]autorelease];

The problem is when I test it via simulator the is being sent, but when I test it in the device the data did not being saved

You probably don't want to send something to localhost on your device, or do you use a different url on the device build?