Sending Data to Website From iPhone - iphone

I'm creating an iPhone Game where I want the user to get a unique numeric code when they first launch the app, that way when a friend of that user opens it, he/she can input that code and both users can get rewarded. I haven't encountered any issues regarding that, however what I want to do is make it to where the app registers the code given to every user and saves it to a website of some sort. That way when the other user enters the code, it will load the data from that website and check if it's registered. How would I manage to save the data onto a website? and also What free website could I use for this without having a character limit on the body page?
-Thanks in advance

Your thinking is correct, in that you need to save your data somewhere online, but you don't really "save data onto a website" in the way that you're describing. "Free Website" services usually serve a different purpose entirely - that of serving up public html pages. Sure, they can take the form of a CMS (like wordpress.com or tumblr accounts), but using that as an interface for storing your application's data is not something they're typically designed to do.
For something like this, where you have a public iPhone app that requires secure access to custom strings, you really want to have control over your own web server (different than a domain name, btw), and interface with a database on that server. This will come at a cost, and will involve more code than you're likely to find someone to write for you on here. Sorry to say it, but hey if someone wants to prove me wrong I'd love to see it.
Because all you need to store & retrieve are random strings (basically referral codes... if I'm understanding correctly), your database needs are pretty simple. If you're not familiar with things like PHP / MySQL, and you don't want to learn, it might be worth reaching out to some server-side developers for help. Unless there's more to it than you describe, you can probably find someone to help you for relatively cheap.
Good luck - and I'm sorry there isn't a simpler answer for ya.

You can send data using NSURLConnection. Just create an NSMutableURLRequest and call its -setHTTPMethod: method with “POST” as the HTTP method. Then, set its body and header fields appropriately, and you can use NSURLConnection to send the data.

Related

EPub 3.0 and HTML Forms

I am creating an epub3 with a form inside. Is it possible to save the information that was inputted in the form locally when the user is offline and send it to a web service if the user is online?
THIS is a good question! Finally...
OK, for the first part of your question (saving the information) you can use localstorage, for some great info on that go here: http://diveintohtml5.info/storage.html.
The next part of the answer is not quite so simple: ideally you could just use some sort of try catch with an XHR request, but chances are that won't work because most ePub3 readers (actually, pretty much all of them except Readium) don't support XHR or external request functionality. See this post for more info on that: http://beneaththeink.com/blog/who-supports-epub/.
If you want your book to be distributed through any of the "normal" channels (pretty much just iBooks since you need Script support at this point) you won't be able to send the data at this point in time...
However, if you will be distributing the book yourself for use on Readium and iBooks (or if you want to plan ahead and hope for support) there are a few hacks you can do. My personal favorite, is embedding the data in a media request (IE www.yoursite.com/fake.m4v?data1=localStorage.data1&data2=localStorage.data2) and pulling out the data on your server. This would be nested in a try catch and activated whenever the book is opened.
If you include the base url (www.yoursite.com) in the .opf file, as well as at some point in the chapter which contains the script, this will work in iBooks! If you don't include it in the .opf the request will get blocked right out of the gate... For more information on why this won't work in the actual iBookstore check out this post: http://beneaththeink.com/blog/external-video-in-ibooks-epub-files/.
Best of luck!!!

Login Logout authentication and uploading views and pics in our applcation

I want to create an application in which i want a login logout authentication from the database file that can be handled by web services. This application should always need to be connected with the internet and after login i need to upload images and also give there views about the image and i am not getting any idea how start work on that can anyone help me.... I want to use this application some sort similar like facebook.
There is also a problem that which type of application i create native or web or else. Please help me to start this application.....
Try setting up a server that can handle the requests from your app. Your app can then request content or upload content to the server using NSURLRequest. For further reading refer http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/URLLoadingSystem/Concepts/URLOverview.html
I think you are asking the wrong question. What web development language do you know to help you accomplish this? There are many different ways to go, like open source as opposed to paid, which services best handle your specific needs, like Ruby or PHP, which RDBMS to use, etc. If you don't know any programming, then it is going to be a long road. Your first step should be taking what you already know and branching from there, learning what you need to know. In your case, you'll need to learn server side scripting, connect it with a database, how to set up a server to put it all in, as well as client side development like javascript to go with the html.

What is the best way to achieve database synchronization?

I am looking to build software that has an Iphone application as well as a Wordpress based website. Essentially the user will enter data into the iphone app that will then be relayed to the Wordpress site and displayed in various manners.
Whats the best way to get the iphone database and CMS database to communicate?
Thanks
This might go without saying, but generally speaking I would try to keep your client (iPhone) app as 'dumb' as possible; Your Wordpress DB should really own all of the content, and the data stored on the iPhone should be as temporal as possible. To put it another way, your app should be like a WP theme. A theme doesn't really 'know' about the WP database - it's just responsible for displaying it (and occasionally adding to it with things like comment forms).
Anyway, as for the actual communication I would recommend keeping as much in JSON as possible (I've found it easier than XML). There's a great plug-in for Wordpress that can help you out, that exposes WP functionality in a JSON-based API: http://wordpress.org/extend/plugins/json-api/
As for working with JSON on the phone itself, I highly recommend the json-framework: http://code.google.com/p/json-framework/ . In short, it'll convert a JSON string into an NSDictionary in one method. Incredibly useful.
Good luck!
May be it's too obvious, but usually for database communicaton used XML, CSV, JSON etc.

iphone - retrieving information from the internet (rss alternative?)

(Very) basically my app is just a load of information collected from the internet - eg: someone can log into an admin panel on a website and update their app from there. The information gets put into a mysql database.
The way I thought about going about this was to use an RSS feed - it works for blog/twitter feeds, so I thought why not do it for the rest of the information that I want to get.
My question is, is this a suitable way to do it? Basically just make dynamic XML files (php scripts that output XML) and parse them on the iphone, or is there a better way to do it?
I'm not looking for a full blown tutorial, just maybe a few keywords that I can go off and look up myself - or a "XML is the best way... stick at that". :p
Thanks a lot.
I personally like JSON more than XML, since it creates less characters to transfer the same data = less bandwidth/transfer used and faster response.
You can use a JSON library from here or just stick with XML since you're familiar with it. I guess it's just a matter of personal preference.

what language combination should I use to permanently modify a webpage?

I'm trying to make a page with 2 fields (email and feedback) and 1 button. When the user clicks on the button, a table on a page else where is filled in with the data, permanently.
Does anyone have recommendations of how I should do this? I'd like to avoid having a script send me an email, or writing to a database. But if I have to, which ever is easier to configure would be prefered.
Thanks,
Matt
So you want a comments system like you find on most blogs? You'll need to store those comments somewhere, probably in a database. As for how to do it, that would depend entirely on what you already know and what the site is currently written in. You could use PHP and MySql if you already have those skills, or ASP.Net/SQL Server, or if you want to be down with the cool kids you can use Ruby on Rails or Python/Django.
If you post what languages you already have experience in, and/or what the site is written in you might get a more specific answer :-)
There're 2 types of scripts: server side and client side. The client side script (JavaScript) stores info only for particular visitor on his computer and this can't be seen by anybody else.
You need a server side script to save feedback on the server. The language or technology depends on the hosting server you use. Not all hosting services allows server side scripts. You need first to find out what scripting languages and technologies are supported by your hosting provider. Then we can help you more.
ADD:
For an unexperienced persons I recommend to search for hosting services which has most needed functionality. Something like blogs, etc. On such services you could create pages that will have comments and feedback and many more.
While it may seem outdated it's not necessarily a bad design. You can use PHP or Perl (due to it's string parsing capabilities) and simply store the main page on the disk.
Here's your sudo code/design...
You'll need need an html page that looks as follows
<tr><td>email</td><td>comment 1</td></tr>
<tr><td>email 2</td><td>comment 2</td></tr>
<tr><td>email 3</td><td>comment 3</td></tr>
Then you'll need a php script page that will read this html file in and display it.
The php page will also contain code for dealing with a user submitted comment. When a user posts a comment you need to open the html page with the rows in it and append to that file.
You need to be careful with this design however because you may run into write concurrency issues if two people attempt to read the file at the same time. Add code to handle this gracefully accordingly.