How to fetch data from website within the app? - ios5

I am developing an app for Lawyers to be used here in Brazil and one of the features of this app is to track the phase of the lawsuit as it develops through time.
It works like this: the user fill a form within the app with the info on the lawsuit and it is stored in a database. Whenever the user wants to know if the lawsuit has any new record, he'll push a button and will get the records ordered by date.
The website that the app will fetch is http://www.tjpb.jus.br the problem is that I donĀ“t know how to code in order to get the app access that site, input the lawsuit number and get the reply displayed on an UIWebView.
So could anyone help me, or just give me a guide on where to find a solution for this?

You will need to asynchronously go to server(via that url) and parse data, then show the responses in UIWebView. But as far as i know you will need a PUSH Server and clerify which data you will show from that site.. This is a great source to get started with app development, you can find video lectures in i-Tunes too

I'm not sure what you really want to do, but one scenario could be that you build a URL, like
http://www.tjpb.jus.br/?...&...
and load it in an UIWebView or if there is a webservice there you should use a lib like ASIHTTPRequest to manage your API calls.

Related

Updating Page Content Without Refreshing Page

I want to update recent notifications on the user's dashboard without refreshing it whenever there is a change in database notification table...as in Facebook where posts and comments are updated in real time...doesn't require page refresh. How can I do it. Any idea?
Thanks in advance.
I work for a company called Realtime (http://www.realtime.co) and we developed a very cool framework to work with real-time data.
It works on the cloud, we offer a lot of different APIs, you don't need to install anything and you can get a free account (with 1.000.000 free messages and 30.000 users per month). It allows you to push data to browsers, meaning you won't be hammering your server with AJAX requests.
On browsers, it uses websockets, if available. For older, non-websocket browsers, we will transparently fallback to whatever is that your browser can use.
Check out http://www.realtime.co and http://www.xrtml.org for downloads and documentation. Please let me know if you need any help as I am the Developer Evangelist for Realtime :)
It is something called asynchronous. Which you refresh the contents of a webpage or a DIV or anything else without reloading the page.
Actually you should use AJAX to load another page into a already present DIV in your page so it will be refreshed on a time basis.
AJAX
The documentation is really simple on w3 schools you can see there.
But the thing is you should use another page called a Handler or something to load and process the contents and then make them ready to be presented in your page and so you can load it time by time using javascript timers or etc.

Caching Feeds from Facebook, Twitter & Instagram

I'm building a site for a non-profit festival where we'd like to have a 'media' page which brings in photos from instagram (hashtag search), updates and photos from Facebook (via festival's albums) twitter posts (by user and hashtag).
I've tried the JS widgets for Facebook and Twitter but wondered about using PHP/Codeigniter to pull the feeds and caching them somehow for better performance and more control over the look.
Would it be best to then store the feed data in a json file on the server or in a MySQL record?
I'm leaning toward a table with a record for each feed that would basically just store the feed URL, JSON, last updated time and an identifier of some sort.
Then I could write a class with the following type of methods:
get_feed($id='facebook_updates', $expiry_time=3600);
Does this seem like a reasonable way to go? or is there a better solution already existing?
I'm not quite sure how I'd work that in with the feeds that need Auth (twitter & Instagram)
bro!
First, it does seem a reasonable way to do it and I don't know any better.
But, if I had to accomplish that, I would break my problem in two:
A server side code to grab the info from the services (that I would
probably store as json so that I could use the info returned
directly) running with cronjobs from time to time.
A client side (server would work too) one to show that info with
customized style.
To work with the feeds that need auth, you'll have to create an app in each of them, authorize it to access your personal account and use it in the code. Never worked with Instagram but the others have good documentation on how to do that.
Finally, with some modification, you may be able to use this wonderful too to help you accomplish your task: http://plugins.in1.com/socialist

Store data of people who clicked on a button on Facebook

I would really appreciate some help with the Facebook application I currently work on.
I developing a simple Facebook application, and I need to store the data of the people, who click the "I want to win button". I'm not sure if I should use plain, old vanilla PHP, or if the Facebook API provides some simple way to do that, so I would be really glad for some ideas about this.
I read about the topic, but I can't really "see the Matrix" yet, so every answer is appriciated. Also I'm more interested in ideas and not the implementation, as I'm fairly confident in my programming skills.
Thank you everybody!
Richard
You will definitely need to use an external db, coz facebook will not store the data for you. However facebook does store the connection that a user makes with the app, i.e. when a user gives some(even basic) permissions to your app. Hence when an old user comes to your app you can know which, and if it is an old user.
Facebook sends your entry script a signed_request, which contains data about the user visiting your app, this request will have a user_id field only if the user has made the connection/authorized your app, hence you know if it's an old user or new.
Once you have the user_id you can call the graph api to get info about the user. In the php SDK you can easily call $facebookObject->api('/me','GET'); to get user info.
You can easily call the functions anytime, so if you want to make a call when a user clicks your button, you can do that.
Check out the links i have included, thoroughly, you'll get the idea.

iPhone HTML5 website on homescreen with jQuerymobile offline splash page?

How do I go about loading a splash to the user if they are offline? I want it to show after the initial loading image, I have a page called gone-offline.jsp but how to detect if user is offline on mobileinit?
I'm not using phone-gap
You need to decide what offline means to your business scnenario. This may sounds silly, but it depends on what your app wants to do. For example:
Does your app want to go offline when it is actually offline and can't reach other websites, or does it want be in offline status when it can't access your webservice.
Assuming you want to test that there is no connection to your webservice I would recommend the following:
1) Make an ajax call every x number of minutes to your webservice to check if it is still online
2) make a common method that handles time outs if your application thinks its online and is offline.
3) make it so that when your application is offline, it is trying to get back online in the background by doing a similar step to step 1.
To do ajax with JQuery see: http://api.jquery.com/jQuery.ajax/
Note that if you require cross domain json (you may or may not) then you will need to investigate CORS/JSON-P/XSS with iframes.
it's very simple using javascript.
if(navigator.onLine)
{
//online code here
}else{
//offline code here
}
(done with jQ mobile)

Twitter Search alerts for iPhone

I'd like to use Urban Airship to send push notifications to a user's iPhone when a new Twitter Search result is found.
I'm pretty positive I'd need a web app built to accomplish this - to register the user's iPhone, save their search terms and poll Twitter Search. How could I go about building this app (in terms of which language to use, etc.)?
Thanks so much.
You are right, you need to build a web app which automatically searches Twitter and then creates a push notification payload to deliver to your users. In addition, you may want your app to also accept requests from users to retrieve the actual tweets. This is because you can't just load up the tweet content into a notification payload, as their is a rather small size limit.
Since Urban Airship works via HTTP, you can use whatever the heck language you want. Just go with what you know, there is no preferred way to do it.
I will say this though - there are lots and lots of tweets added every second. Scalability is probably going to play a pretty big factor in whatever you are trying to do. Which is probably why a year later there aren't very many Twitter apps that support Push.
Everything said previously is correct, I just wanted to add one thing:
I strongly recommend looking into http://superfeedr.com to handle getting te data.
With Superfeedr, you can take advantage of their PubSubHubbub API and not have to do any of the RSS parsing yourself.
Here's how the flow would work:
User subscribes to a Twitter user/search on the phone.
Phone tells your service that User X has subscribed.
Your web app registers with superfeedr to watch that RSS feed (and you keep track of this relationship)
When a new item appears, Superfeedr POSTs to your web app with the latest items.
You look up the relationship between user and feed and tell Urban Airship to send an alert to that user.
This way, all your webapp has to do is intelligently keep track of relationships.
#bpapa is right and you should use the language you know best. Also, I would recommend looking into Twitter Streaming API, it will help you make your application actually realtime.