how to get data from web server to iphone or ipod - iphone

I'm quite new in iPhone development and I need to develop an app.
I must get mp3 data from a web server, which provides a simple saving the mp3 in my app document or folder
and use it in an application, which should also dislpay a table with rows like:
song1
song2
song3
But at present I don't know at all how to get this web page, parse it and store into an array in the application.
Please do you have any suggestion / hint / sample code ?
Thank you in advance,

There is a tutorial on the apple developer site on how to make a http request and receive data here. Should get you going on how to fetch the web page.
For parsing you can use the NSScanner or a XML/HTML parser library like TouchXML depending on your needs.

I used web services to communicate with web server, the following tutorial helped me a lot.
http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
I was able to send and retrieve binary content using web service but I had to encode it first to be able to send it through Soap request and decode back Soap Response.
Hope that can help you,

Related

How can I upload multiple images?

I would like to upload images along with a couple fields of data to a server from my app. How can I do that?
many web services do that like JSON Soap rest, you should learn to program a web service along with programming iOS.

Communication Of iPhone and Google App Engine

How can I get a pdf data (stored in datastore as blob) from iphone if i make a request to google app engine?
When I use
self.response.out.write('asadasd');
in google app engine code
I can see this 'asadasd' in iPhone.
But i don't know how to set this communication so that i can get a pdf data from i phone.
Thanks in advance!
If I understand corretly, you want to send an pdf file to a webapplication, right?
I think it would be a solution to base64 code the binary data of the pdf on the iphone (that comes from your blob) and then send it via http post to the webapplication.
You should set the proper headers before writing to the output stream:
self.response.headers['Content-Type'] = 'application/pdf'
self.response.headers['Content-Disposition'] = 'attachment;filename=filename.pdf'
self.response.out.write(...)

How to retrieve data from a website into an iphone app

I am making an iphone application.
I am a newb.
I want to fetch the data from my website. What should i do to implement this?
What needs to be done?
Help me please
Thanks
Any tutorials would be of great help.
If your problem is getting data from website to iphone then you can just use JSON Parsing to get data.
Just you have to pass all the data as JSON string in iPhone from your website. And then parse the data once received into your iPhone.
Here you can refer to this link
http://www.raywenderlich.com/5492/working-with-json-in-ios-5
Hope this helps you
You will be using the NSURLConnection, NSURLRequest and NSURL classes here is an example from Apple; http://developer.apple.com/library/mac/ipad/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
Expose your data from your site as WebService, XML, JSON etc. Consume that using iPhone app.
Which language is being used your site?depending on that some sample could be provided.
Chapter 10 of James Kennard, Mastering Joomla! 1.5 : APIs and Webservices contains 8 pages about XML-RPC.
For real-live examples, search the Joomla! Extension Directory.
http://extensions.joomla.org/extensions/search/xml-rpc
Here is another one to kick-start http://www.slideshare.net/coolparth/rest-api-for-joomla
For the server side, I suggest using a web service to send the data to your client.
ORIGINAL AUTHOR'S REVISION:
The September issue of Linux Journal has an excellent article on writing mobile apps that work for Android AND iPhone/iPad using free tools and frameworks. Here is a link to the article online:
Developing Portable Mobile Web Applications
Previous answers suggest using NSURLConnection, but I find it to be a bit cumbersome to use on its own. I suggest using something that wraps NSURLConnection (or CFNetwork). Some examples: ASIHTTPRequest (CFNetwork-based), httpriot and Seriously (NSURLConnection/block-based).

getting data from server and store in the iPhone

i want to develop an iPhone app where the app downloads data (say audio clips) from a specified server and stores it locally on the device.
then the app should use the data stored in the device rather than stream it from the server.
could anybody give me the guidelines as to how this can be done? tutorials and samples also appreciated. Thanks :)
The easiest way to play files from the internet is to use -[AVAudioPlayer initWithContentsOfURL:error:]. If you want to make sure that the whole file is downloaded, I think your best bet would be to download the file using NSURLConnection (see the URL Loading Guide) and then using -[AVAudioPlayer initWithData:error:].
Look into ASIHTTPRequest, you will find it much easier to fetch large chunks of binary over the web asynchronously than if you try to code everything yourself.

iphone XML attachments

My iPhone app will be receiving an xml feed from a Java web service. The xml is in a SOAP message. I can easily parse data from within the xml however there is a jpeg attachment to the SOAP message that I need to display within the iPhone app. Does anyone have example code or a link to some documentation on how to work with SOAP attachments on the iPhone?
Thanks
I'm not 100% certain, but I'm reasonably sure that wsdl2objc supports binary attachments. Documentation is sparse, however.
That said, if you are parsing the message by hand, take a look at the Message format from w3c; it's just MIME attachments, which means it's going to base64 encoded. Unfortunately, the iPhone SDK doesn't have a base64 encoder/decoder, so you'll have to roll your own or use a third party library. This article should help you roll your own.