ASIHTTPRequest Post data from iPhone to PHP - iphone

In Objective C I want to create a simple application that posts a string to a php file using ASIHTTPRequest.
I have no need for an interface and am finding it hard to find any example code. Does anyone know where I can find code, or can anyone give me an example of such code?

The ASIHTTPRequest documentation covers this. Specifically, Sending a form POST with ASIFormDataRequest.

This site has a really great walkthrough on how to use ASIHTTPREQUEST to authenticate data against a database. the walkthrough breaks the entire process down file by file for you.

Related

Getting data from remote sql table on iphone

I am a beginner at both iPhone programming and SQL, yet I have basic knowledge of them.
I am planning to do an application that would plot a graph from data taken from a database of the server of my company. I know how to plot, I know how to extract data from an sql table, but what I don't know is how to access the server.
So do I have to go through some kind of oracle-like application ?
This may seem like a very stupid question because it might not even be possible but any answer will be appreciated.
Thanks !
Go through a web service for example a PHP page that returns JSON (or XML, but JSON is easier to parse).
I can highly recommend this tutorial
Once you have your web service, you can use NSURLRequest/NSURLConnection to download the data and use a JSON framework to parse it. Or, if you're using XML you can use NSXMLParser.
See this apple code for more info on downloading using NSURLConnection.
The best way for this will be, using APIs at server end that handle the client request and perform database interaction, so transfer of data among device and server, take place through XMLs that will be secure as well as fast.
It is definitely possible to contact a server (I can't imagine what would happen without that!). What you are looking for is NSURLConnection. Have a look at the example provided by Apple.

How to write a server for an iPhone app

I'm writing a very simple iPhone app, basically a dropbox where people can submit ideas and then view what's in the dropbox. I need to write a server that will respond to my iPhone's (HTTP?) requests. Are there any good tutorials on the web that will show me how to do this? Thanks.
Well it really depends on what kind of platform are you trying to write your server.
If it's going to be linux, apache, mysql and PHP (LAPM) then probably this question would answer some of your questions: Serving a json file for IPHONE app
Also this one might be helpful: http://www.sencha.com/learn/Tutorial:Creating_JSON_Data_in_PHP
You could server your data in various formats: binary, XML, JSON, etc. However if I were you i would definitely choose JSON ...
You also can use ruby, .net or anything else for building your web server, however probably php is going to be the one with the most examples.
Hope this helps.
For communicating with the server take a look at ASIHttpRequest, which has some good documentation and example code included http://allseeing-i.com/ASIHTTPRequest/How-to-use
i recomment using the ASIHttpRequest Classes.
On the serverside just use a simple JSON API and probably oAuth or HTTP Authentication to submit and receive Data from a Database.

iPhone programming: how to use URL's API (e.g. BLAST)

I am new to iPhone programming and would like to be able to use the BLAST (is a bioinformatics server) URL's API from the iPhone. I would like to write a very simple application that queries the BLAST server and make some query. I have found the following
I have found the following documentation on BLAST (http://www.ncbi.nlm.nih.gov/BLAST/Doc/urlapi.pdf).
I am not sure from where I should start.. I checked out the following on security concepts for Mac OS X and iOS(http://developer.apple.com/iphone/library/documentation/Security/Conceptual/Security_Overview/Concepts/Concepts.html) and then found CFNetwork library (http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html).
But I don't really know from where to start..
theoretically I would like to query the BLAST url API from a .mm class method (so I can use standard C) and then show the results in a normal view.
Anyone would be able to guide me in these first steps?
Best regards and Many thanks!
The BLAST API is strange. It is a POST-only command-response API, but the commands you POST are things like CMD=Get&..., CMD=Put&..., etc.
The iPhone SDK provides a fairly convenient high level way to invoke URLs. Have a good read of the NSURLRequest documentation. You'll need to set the HTTPMethod property to POST, and populate the HTTPBody with whatever the BLAST API tells you to post.

If I want my iOS app to use a RESTful WebService that returns XML data, which APIs do I want to start learning?

I'd like to build in some weather functionality into my app and I'm going to be using the NOAA weather web service to retrieve the weather information. The NOAA website has a great deal of information on how the data should be requested and how the resulting data is structured. I'm new to iOS development, so I just need a little direction because I'm not sure which APIs I should be using to request and process this data. My questions are...
What's the proper way to request access to the user's location?
If the user allows access to their location, which APIs would I use to access it?
To make an HTTP request to the RESTful webservice, which APIs should I use?
To process/parse the resulting XML data, which API's should I use?
And if anyone can suggest any good examples online that demonstrate any of this functionality, that would also be helpful.
Thanks so much so much in advance for your wisdom!
For location data, look into CoreLocation
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CoreLocation_Framework/index.html
For HTTP requests I like to use the ASIHTTPRequest class
http://allseeing-i.com/ASIHTTPRequest/
TouchXML makes it easy to work with XML data
http://code.google.com/p/touchcode/wiki/TouchXML
Just today, Luke Redpath posted a complete iPhone REST client he wrote. I can't vouch for it, I only saw today that it even exists. But Luke does good work, so I assume it's pretty decent.
See here:
http://lukeredpath.co.uk/blog/some-code-that-i-wrote.html

GData Google API Objective-C client help for iPhone

There seems to be no available documentation for the Objective-C client for the Google Data API. Google's API help webpage only has options for .NET, Java, Python, and the HTTP Protocol. I want to access data from a spreadsheet on my Google Docs account, and then add new data.
I have added the correct source codes to my project as outlined in the GData Wiki, and am now completely lost. There are a ton of classes to sort through for Spreadsheets, and there are very few comments and I can't really tell by method names what does what.
If possible, can someone post a couple snippets of code to first access the available documents, then pick one of the choices, and then add information to a cell (like A1)?
Thank you in advance for your consideration!
Did you look at the spreadsheet sample?
http://code.google.com/p/gdata-objectivec-client/wiki/GDataObjCIntroduction
A year or so later, a page for just this: Google Data APIs Objective-C Client Library
Generally, to create a new entry, you'll use an http POST to the feed's postLink. The Obj-C library service class provides POST operations as the method fetchEntryByInsertingEntry:
I believe creating a new spreadsheet still requires uploading a new document, as mentioned in the docs. You could create a simple CSV text file and upload that as a spreadsheet.
Note that there is a discussion group for users of the library.