I'm trying to retrieve data from a POST method, code as follows:
-(void)postXMLFeed:(NSString *)XMLStrPost
{
//NSLog (@"XML Feed3: ", XMLStrPost);
NSURL *url = [NSURL URLWithString:@"http://xxx.xxx.x.xxx/stephen/sync_upload.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[XMLStrPost dataUsingEncoding:NSASCIIStringEncoding]];
NSURLResponse *response;
NSError *error;
response = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
// Update log file.
NSLog(@"XML feed POSTED to website.");
//[super postXMLFeed];
}
My XML feed is stored in the variable XMLStrPost
. The above code seems to work but I have no way of confirming it.
The script should unparse the string and write it to a database, but this does not seem to be happening. Before the unparse takes place I want to confirm that script is being called.
How can I confirm that sync_upload.php
script is called?