I am working on web base application in ios.I want to get only the desired data from the web .
for e.g. If there is a site which showing the information of train code , train schedule, seat availability i want to get the data related to only seat availability from that web page and render it to my own table. Is it really possible ?
I am not an iOS developer, so I can't give you code on how to do it.
You'll be needing an HTML parser. The process is commonly called web/screen scraping. Have a read at this: https://stackoverflow.com/a/3541965/459338
You can use a HTML Parser or use Regex to extract the pattern of the data that you want from the given url . However try to check whether the data provided by the website is copyrighted or not else you cannot use their data publicly via another interface without their permission.
Yes it is possible. For doing this you will be using the method of Parsing . Depending on the type of API you are getting whether it is JSON, XML or HTML etc , you can parse the desired data accordingly. You can check for the API's on the web for the type of information you would want to parse. Otherwise the database option is always there.
Related
Good day,
I want to communicate between two Web Api's, the first web api lets call Api1 not written by me and that api interacts with my data base to spit out information needed.
I have web api2 which would be written by me and why i have this is because my application needs data in certain kind of format (.dll) format.so api2 purpose is to get the information from api1 and then transform or package my data in a way that the my application would understand.
The question, is this possible?. can i use wrappers, so when i get my information from api1 then i wrap my information in the desired format before sending it off to the application. Does anyone have any other suggestions ?
Thank you in advance,
What you describe is possible but the requirements are too vague to give a useful answer.
The file extension doesn't really mean anything so not sure why you need .dll format for the message. I would use a standard format like Json or Xml. Or if using datawindow you could simply do saveas on sending side (or comma delimited, tab delimit) and file import on receiving end, so many options.
Too vague.
Async or Sync interface?
Files transferred via REST, OLE, DDE, or files written to location on server?
Are the files/data transferred specific to a logged in user?
How much data is being transferred, rows of information or configuration data? Answer will help in deciding on appropriate format & best method.
What type program is API #1 not in your control? That is important factor.
I want to fetch table data from the website using perl: http://finance.yahoo.com/quote/LBJ/history?period1=946665000&period2=1470162600&interval=div%7Csplit&filter=split&frequency=1d
but it's source code does not contains any data of table which we can see on website, there is one download link but that downloaded data is not same as data shown on website.I want stock split information shown on this website, yahoo provides download link to download that data but here downloaded data is different then they shown on website, by mistake they provide dividend history information,but I want split history information.
The page is built using a number of Javascript calls.
You should use the developer tools that are built in to your browser to trace all of the HTTP requests that are used to build the page. One of them will return the data which is used to build the table. Hopefully you will be able to recreate that call to get the data directly. It's likely that the data will be returned as JSON, which will make parsing it much easier.
Update: It's worth adding that sites often build pages this way precisely because they don't want people to scrape their data. Have you checked the terms and conditions of the site? Are you allowed to access the data this way? HAve you looked to see if you can get this data through an API?
I have an app that basically has news and updates about a certain subject. How do I get it to work that when I update something let's say in my website it would also update what's on the app. Do I usee RSS for this?
You need some web service to deliver the data. In terms of what format a web service can use, there are a variety, but two prevalent formats are XML and JSON. RSS is, essentially, a particular form of XML.
On the iOS side, you can parse XML using NSXMLParser (see NSXML Parser Class Reference). If you're parsing JSON, you can use NSJSONSerialization (see NSJSONSerialization Class Referece). For both of these, you can google the class keyword followed by "example" or "demonstration" (e.g., "NSXMLParser example" or "NSJSONSerialization demonstration") and you'll see tons of examples. If you have an RSS feed, you can google something like "iOS RSS example".
It may be dictated by what you can easily render from your server, XML (or, in particular, RSS) or JSON. For example, if you're using some content management system on your web site, it might offer RSS feeds, or something like that. In the absence of that, you may have to write your own server interface to retrieve the data in XML (or RSS) or JSON formats.
In addition to #Rob answer I would point couple mode things:
You can simply prepare databases with your information (like SQLite) and just download them from your web site to your application.
You need to have some way of notifying application about new content and for that you might want to use remote notifications. http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html - this way you can send notify messages to your app, and user will know that there is something new to download and read.
In my application i need to create and save data into an xml file on my webspace and then i want to parse that xml into my iphone app. The question here is this is being done by two different parties a sender and a receiver.
But i don;t know how to parse that xml file into my app when i don't have the excat url of that xml because there will be number of people who will be using this app so how i can allocate the xml a specific url and pass that url at receiver end.
Thanks,
As there is a lot to this question I can only give you a vague answer to keep it short. The type of communication I recommend using is NSURLConnection. That will allow you to get the contents of say an xml from a URL.
As far as identifying individual users there is a few ways all of them a fair bit of work. You could create a sign in where the user has a unique username or email. Store that in the database on your server and pass it as part of the url.
You could also sort of use push notification registration where your server is required to keep an iPhone unique identifier to push information to Apple. I don't know enough to push notification to give you much guidance in this but if you don't want the user to create an account I think this would be the way. You could also query the server for a unique ID and store it in NSUserDefaults.
I would recommend the user account creation though. Also have a look at NSXMLParser for your xml parsing.
Beyond this help ask a more specific question. There are also many other ways to do this, its just the way I do it.
I can help you with the parsing of the XML.
iOS (like mac) has a built in XML parser.
Still I would recommend you use an external library, there are several available out there.
In a recent project, I very successfully used TouchXML: http://github.com/schwa/TouchXML
Here is a very simple tutorial on how to use the TouchXML library to parse XML files:
http://foobarpig.com/iphone/parsing-xml-element-attributes-with-touchxml.html
Is it possible to pull information from a website and display it in an iphone application?
I am looking to pull the current temperature and barometric pressure for an airport from the http://adds.aviationweather.noaa.gov website and display those two pieces of information in an app.
This sounds like a common task that programs do all the time but I'm not sure how it's incorporated into an app.. (what is the process of pulling webdata called?)
What methods or tools are available to do this? I am unfamiliar with handling web data for iphone at this time.
If they have an actual feed for the data, you could access it using NSHTTPRequest and parse the results.
If you need to screen-scrape the data off the page itself, then I would highly suggest creating your own web service to do the parsing and have your iPhone app talk to your web service. The reason being that if they update the page in a way that breaks your screen scraping you would only have to update your web service instead of deploying an update out to who-knows-how-many iPhones.
Just use an NSHTTPRequest and all the related classes to assemble a standard HTTP GET request for the site with the data you need. If there's a data feed (XML, JSON, etc.), you should find out what that URL is and use it instead of parsing the actual HTML of the web page. If not, the method is called "screen scraping" and it basically involves you writing a regular expression to parse the HTML of the web page returned from the server. Again, don't do this unless there is no alternative data feed you can use.
If you need to parse XML, see NSXMLParser. There are open-source solutions for parsing JSON in Objective-C. Just Google around for them.