I have a problem getting data from the server. server is my localhost.
SMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"localhost"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setHTTPBody:[NSString stringWithFormat:@"test.php"]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (connection)
{
NSLog(@"NSURLConnection connection==true");
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"responseData: %@", responseData);
}
else
{
NSLog(@"NSURLConnection connection==false");
};
on localhost I have simple php script called test.php:
<?php
echo "It works!!!"
?>
If I'm opening localhost/test.php in safari I can see "It works!!!"