PDA

View Full Version : Http Get




Kareny
Jul 12, 2010, 03:22 AM
Hey guys,
I have a problem about HTTP GET in objective-C.
I added two parameters followed by a website, and then upload to a web service.
For example:
NSURL *url = [NSURL URLWithString:@"http://www.mywebsite/Upload?parameter1=value1 & parameter2=value2"];

and the code works fine, I can get parameter1 and parameter2 on my web service.

My questions is how can I change the parameter to a Textfield.text?

Thanks very much!!!



dejo
Jul 12, 2010, 12:28 PM
NSURL *url = [NSURL URLWithString:@"http://www.mywebsite/Upload?parameter1 & parameter2"];
You sure the URL doesn't look something more like @"http://www.mywebsite/Upload?parameter1=value1& parameter2=value2" ? That's how a normal URL includes parameter values.

My questions is how can I change the parameter to a Textfield.text?
You should look into how to format a string to include an argument list. I'd start by looking at the String Programming Guide (http://developer.apple.com/iphone/library/documentation/cocoa/Conceptual/Strings/introStrings.html).

Kareny
Jul 13, 2010, 08:13 PM
[QUOTE=dejo;10510540]You sure the URL doesn't look something more like @"http://www.mywebsite/Upload?parameter1=value1& parameter2=value2" ? That's how a normal URL includes parameter values.


Yes, it is parameter1=value1 & parameter2=value2!!:p Thanks for the correction!

Kareny
Jul 13, 2010, 10:18 PM
You sure the URL doesn't look something more like @"http://www.mywebsite/Upload?parameter1=value1& parameter2=value2" ? That's how a normal URL includes parameter values.


You should look into how to format a string to include an argument list. I'd start by looking at the String Programming Guide (http://developer.apple.com/iphone/library/documentation/cocoa/Conceptual/Strings/introStrings.html).

Thanks a lot!! I got the solution and the problem is solved:D