1

I would like to know how can I input array of data in an URL API in iPhone development project?

For ex: I know how to input just strings like below,

http://www.myserver.com/myservice/name="MyName"?date="SomeDate"&time="SomeTime";

But I need to send array of name, date and time here, not just one. So, how can I send array of data in an URL api?

Please advise!

Thank you!

3
  • Try to send it as xml or JSON. Commented Jan 10, 2012 at 11:59
  • Hi, Thanks for the reply. Could you show some samples? Commented Jan 10, 2012 at 12:03
  • As far as I understood you want to pass the parameters name, date and time. Can't you pass on the array with these values and then make a string like [NSString stringWithFormat:@"myserver.com/myservice/name=\"%@\"?date=\"%@\"&time=\"%@\"", [yourArray objectAtIndex:0], [yourArray objectAtIndex:1], [yourArray objectAtIndex:2]]; Commented Jan 10, 2012 at 12:37

1 Answer 1

3

You can send an http post with xml or json data.

One way is ASIHTTPRequest: http://allseeing-i.com/ASIHTTPRequest/

Here's some samples showing post and other HTTP verbs: http://allseeing-i.com/ASIHTTPRequest/How-to-use

You can also post data using NSURLConnection directly: http://www.deanoj.co.uk/ios-development/making-a-http-post-request-with-nsurlconnection/

Sign up to request clarification or add additional context in comments.

3 Comments

Hi, I'm sorry, Could you advise where it is used inputting array of data in these links?
Actually the input will be one by one not like you think that you just pass an array and it will picks up all element the input way will be allocate value to each variable separately and then you will call the url.
The data needs to written to XML or Json and then it's sent as the post data in the http request. The server then parses the XML or Json. This is what rest services are based on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.