Re: Question about sending to PHP from Obj-C
Re: Question about sending to PHP from Obj-C
- Subject: Re: Question about sending to PHP from Obj-C
- From: Keary Suska <email@hidden>
- Date: Thu, 04 Aug 2011 08:55:04 -0600
On Aug 4, 2011, at 7:52 AM, Eric E. Dolecki wrote:
> I have a little script sitting locally on my Mac (webserver).
>
> http://eric.domain.com/iOS_Log/logger.php:
>
> <?
> $myFile = "yabba.txt";
> $fh = fopen($myFile,'a') or die("can't open file");
> $query = $_GET["string"];
> $stringData = $query."\n";
> fwrite($fh,$stringData);
> fclose($fh);
> ?>
Just a note that it is not useful to post the PHP code--not only is it not relevant to your case, there is no guarantee that list members are familiar enough with PHP to make real sense of it.
> I am simply trying to send the PHP a small string from my app on a device.
> I've seen examples of POST everywhere, but looking for GET.
>
> Of course if I do *http://eric.domain.com/iOS_Log/logger.php?string=Foo* in
> a browser it works fine.
Anyway--can you be more specific about your problem? Regarding specifying query strings, Cocoa doesn't provide any convenient means that I know of to build query strings so you have to manually assemble them. Something like:
NSString *urlString = [NSString stringWithFormat:@"http://eric.domain.com/iOS_Log/logger.php?string=%@", [foo stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSURL *url = [NSURL URLWithString: urlString];
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden