Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Community Center > Off Topic

Reply
 
LinkBack Thread Tools Display Modes
Old 02-23-2010, 07:37 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 193
Default Json web service 4 iPhone

Ok ive got the iphone app reading the json echoed by the php reading mySQL. However, i tried it with just one user so i had the iphone add read a hardcoded user.php file echoing the json string.

Now i want to make it like the twitter app from Presence Stanford where the TwitterHelper class is able, (i think because of the API, so the solution to this will be a server side coding in php presenting json), to read individual users status info. The string in that app reads something like NSURL http://%@/users/json/%@.json, where the first %@ is just the twitter.com server and i assume the %@.json refers to the particular user passed in from the authentication.

So my question is, server-side, is the API producing a page per user on request from the iphone app? So my php now needs to be like the action part of an html form, receiving a username and then getting that record from the db and producing a new page upon request called user.json? Im not sure im clear on this? So the server will have as many user.json pages as i have users in my application? All those pages, albeit small cause theyre just json files, will be physically residing on the server at once? Or do they get momentarily produced and then deleted?
marciokoko is offline   Reply With Quote
Old 02-25-2010, 08:44 AM   #2 (permalink)
Mobile and Web solutions
 
hello24's Avatar
 
Join Date: May 2009
Location: London, UK
Posts: 72
Send a message via Skype™ to hello24
Default

Yes, you'll need a REST-ful interface for your web service.
Have a look at the Twitter API for an example:
Twitter API Wiki / API Overview
hello24 is offline   Reply With Quote
Old 02-25-2010, 12:25 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 193
Smile json php webservice

Youll be glad to know i got it working. I think this is what a webservice is, maybe ive been calling it something else.

Ive got the mySQL db sittin on a server in the cloud. There is a php read.php file and a write.php file.

The read php file takes the arguments for user and then reads the mySQL db and returns a json string which iphone reads and presents.

The write file takes the arguments input by the user and posts them to mySQL db.

So is this it? Now im only missing something that the server can use to update a 3rd updatedread.php file that will read the db every so often, get updated data and create an xml file that iphone can go and fetch whenever the user wants to get updated data...

Quote:
Originally Posted by hello24 View Post
Yes, you'll need a REST-ful interface for your web service.
Have a look at the Twitter API for an example:
Twitter API Wiki / API Overview
marciokoko is offline   Reply With Quote
Old 11-26-2010, 03:46 AM   #4 (permalink)
Registered Member
 
Join Date: Apr 2010
Location: Vegas
Posts: 11
Default Looking for a little assistance...

Hello,

I am in need of a little help, I have my first app up and running smoothly, but I want to add the functionality of the user being able to hit a button that says basically.. "Sync" and have the App contact the web Server(MySQL, PHP) and retrieve the info in the database that corresponds to that users login, then have that info populate the SQLite db on the iPhone for offline access and updating. Then the user can later hit the "Sync" button again to Sync the iPhone back with the Web DB.

I get the impression that the best way to do this, is to use JSON, but I haven't been able to find any examples or info for integrating such into an existing app. As of now, I have the Web Server complete and ready to go, and the app is as well (in regards to being functional)

I am a little new to this, so I need an idea as where to start, does anyone have some code examples of what I need to accomplish??

any assistance would greatly be appreciated.

Thanks
SevenOTwo is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 281
17 members and 264 guests
2WeeksToGo, ADY, dacapo, Dani77, Fritzer, ghost, HDshot, headkaze, iDifferent, mer10, mystic.purple, Rudy, smethorst, stoneage, superg, tathaastu, Zool
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,878
Threads: 89,224
Posts: 380,732
Top Poster: BrianSlick (7,129)
Welcome to our newest member, olga2000
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:42 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0