views:

62

answers:

2
    NSString *myRequestString = [NSString stringWithFormat:@"&nbr=%@&import=%@",tmpString,noSpaces];

NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ];
NSMutableURLRequest *request = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: @"http://mysite.com/contacts.php" ] ]; 
[ request setHTTPMethod: @"POST" ];
[ request setHTTPBody: myRequestData ];
[ request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];    
NSData *stringReplys = [ NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ];


contactprogress.progress = 1;   
StatusLabel.text = @"Status: Complete";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:stringReplys
                                               delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];   
[alert release];

tmpStrings is just a number phone number like = 07919327368 and noSpaces is a list of contacts and numbers formatted with no spaces i cannot see why this would not work ?

I know the php is fine as i can send post's via my pc

Thank you

Mason

Could it be that the data is too large

A: 

One thing that seems wrong is that you have:

[ request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];    

and I believe you want to use:

[ request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];    

I'm not sure if the Content-Type is getting set automatically by some other call, but that could cause a problem with the data not being decoded correctly.

christophercotton
no this is not the problem
i fixed it the problems was the ALERT
+1  A: 

The problem was the ALERT it couldnt show stringReplys as it is a Data have to convert to string using this :S

stringReply = [[NSString alloc] initWithData:dataReply encoding:NSUTF8StringEncoding];