views:

25

answers:

2

Hi,

I need your advice. We have an already working web resource management application, we use the usal tools html, css, php, mysql, the users logs in, create a new issue and data is saved/retrieved in/from a sever, everything ok.

The thing is that they ask me to develop an iPhone app using objective-c to emulate the functionality. Now, I have some thoughts on this:

  • One aproach is to just make the ajax optimizations so the website runs like any other iphone web app, honestly not convenient for me, they'll hire a web developer.
  • The native app could request the web pages, parse html and maybe get the values to display them, lets say ... in a tableView
  • The last one and wich I thing should be the most "simple" is to call the php scripts that will make requests to the database and get the data without tags.

I've diggen in the said php scripts and discovered that they have embeded html, so, does that mean there's no way to scape from parsing html?

Please give ideas to clear this problem, thanks in advance.

A: 

The mix of data/HTML isn't going to be pretty.

You can do some sort of clean up using Objective-C string functions, but the code will be pretty one-off and crufty.

Instead of calling those scripts straight off the server, you might consider adding a second, parser-like PHP script to work as a middleman. You call it, it calls the original script and returns a data structure that you can work with, like JSON.

editor
+1  A: 

While scraping might seem like a quick and easy way to get the job done, it's one I'd really not recommend using. This is because at any time the HTML served by your web application can and will change, and that will potentially break your application, which will waste a lot of time making little fixes here and there, releasing updates to your app with these fixes and so on.

I'd recommend working with your web app guys to come up with a proper REST API so it makes things easier for you and your iPhone app.

BoltClock
Yep, actually they have an xml-rpc API but I discovered later. Thanks for your advice.
iPhoneDevProf