iPhone: Try to send html code to a php script (but fail)
- by Marc-André Weibezahn
Hello all,
I am trying this for an iPhone app in Xcode:
create html code for a website on the fly
sending it to a php-script and getting the response with this code:
NSError * error = [[[NSError alloc]init]autorelease];
NSURL * phpURL = [NSURL URLWithString: @"http://www.mydomain.com/myscript.php?mywebsite= (...websitestring...) ];NSString * myResponse = [NSString stringWithContentsOfURL:phpURL encoding:NSUTF8StringEncoding error:&error];
It does not work. It should not be a problem of the php code because when I replace the websitestring which contains the html code with "hello" or something, this is accepted. (the script then creates a file "test.html" with the content I sent.) But when I put html code in it, I always get the error:
Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x322ec10 {}
It seems that there are some things to consider when sending code to php?
Thanks in advance!