Appmobi Codeigniter and Facebook SDK JavaScript vs PHP - php

Ok, this isn't going to be the best quality question without a doubt. But I am looking for advice mostly on how to handle the next phase of an app I am developing. This is my first app in appmobi so things with it are a bit confusing to me still.
So generally speaking I am very used to working with PHP and sticking to browser based development. With that most of what I want to do with Facebook as far as the API's go for the graph I have done using the PHP FB-SDK. If your familiar with Appmobi then you know php is out well directly at least.
This app I am making, I have it working fine with everything else I am doing. I'm communicating with my server, people are logging in, people are registering, people are using the server for what its worth. But this Facebook bit has me stumpped. I want to offer facebook as a means of login/registration for my app, I want to post to facebook from my app pending a user approves it, and a handful of other things. But I dunno the best way to approach this through the app as its all static html based pages and javascript thus far.
So I am hoping someone will read through this all, and hopefully a handful of you that do, will know some means of doing what I want to do, Im not looking for someone to drop me a pile of code and give me the answer (nice as that would be). No I am just simply looking for what I should do to handle this between all the layers mentioned here to make this work. So I can start building this piece up.

Regarding Facebook, appMobi has recently added a Facebook object to the API you might use to be able to log into Facebook and access the Facebook Graph. You can find the Facebook API documentation here:
http://www.appmobi.com/documentation/jsAPI/facebook/index.html
There is a supporting document illustrating how to set up things on Facebook's side that can be found here:
http://www.appmobi.com/documentation/index.php?DOC=FACEBOOK_INTEGRATION
I'll do my best to post some sample code as well. I'm kind of working through the exact same thing.

Related

Get data from a website to iPhone app

I have a couple of questions. I hope people can give me a good view because I am stuck at the moment.
It's a year since I started developing so please bear with me.
How can I get data from a website that I don't own to my application?
I have done some database parsing before but that's all from my own website. I see people use different library's (HPPL for example).
But what if the website requires users to login? And besides does that work on HTML only? What about if it's a PHP based site?
Should I get the external data directly on the iPhone when opening the app or should I use a middle-man approach (server between external website and app that handles the info)?
3) What is the best way to save login information so that a user doesn't have to fill in every time he opens the app?
I am a bit confused about all the stuff so maybe you can clear things up.
The question is extremely broad; so you will get pretty general answers.
Essentially, you are asking how to consume a web service. For that question, I'd recommend one of several tutorials online, like this one. There are others. That should give you a start.
You should understand the Cocoa URL loading system. The documentation is very complete. You can certainly use third-party libraries for this, such as AFNetworking; but I would recommend you understand the Apple -provided frameworks first.
But what If the website has a login ?
Depends on what sort of authentication we're talking about.
And besides does that work on HTML only ? What about if it's a php based site ?
No. Should be no different.
should I get the external data directly on the iPhone when opening the app or should I use a middle-man approach (server between external website and app that handles the info)
In general, a simple design should be favored over a more complex design so long as it meets your specifications. There's probably nothing the intermediate server can do that the iPhone cannot - but we don't really know your specs.
What is the best way to save login information so that a user don't have to fill in every time he opens the app I am a bit confused about all the stuff so maybe you can clear things up...
You will want to investigate the Keychain then. See this SO question for a bunch of tutorial references.

Need help to figure out how to do a remote API connect call on my site

I have some skills in PHP and now I'm planning to develop a connect function for remote login to my web side. I can't find any useful on Google.
Some idees on how to code a API connect button? Something similiar to Facebook connect, Twitter connect etc. BUT this should not rely on facebook api. I'm going to make my own stand alone api.
I know I need to use REST in backend, but I'm missing the knowledge to know how to send / recive the login data, and how to know when a user are online or not.
I also know that the user will need a key of some sort.
My plan was something so easy as this:
yourdomain.com/api?id=xx&key=xxx&what=
then what is should be the action with som parameters like:
if($what == login) {
handle the login part here
return the data
}
I can handle the php on the server side, but don't have a clue on how to handle the rest except the remote site must get the data in json or xml format and save in database.
Then when connect, it sends some data back to my site.
But HOW?? Here I'm stuck.
Also how to figure out when user are online on the other site or not, and how to get the image for a button. Like Facebook have a blue icon.
I guess it's a call back to my site for getting the image from there, right?
Greatfull for any answers on this one.
Its a pretty large topic you have there, you'll need to do some research as there are many many ways and technologies and security aspects related to this.
I'd suggest you go with a secure connection on a SOAP service based off Zend Soap Server and Zend Soap Client. But then again, if you don't want to use ZEND or SOAP, you'll have to look at other methods.
I wouldnt use REST because REST is used to manage data such as PUT/POST = UPDATE/INSERT, DELETE = DELETE, GET = SELECT so i don't really recon this would make sense.
My biggest point i have to make is, MAKE APIS, something simple, you don't want people to have to ask you for help or read documentation on how to access your authentication service. Go something simple, clean, portable and provide API to simplify your user's experience.
My 2 cents :P

Saving peoples progress on flash games onto a site

I know there are sites out there when you log on to their account they can play swf games or otherwise flash games on the site so whenever they go to another computer they can continue their progress without restarting just by logging onto their account.
I would like to know how they do this. So I can added it to my site. I honestly have no clue where to start to learn this. Any help leading me to the right direction. Or if you can give me some code. I would appreciate it more.
Well, you'd need to create a php/mysql based API for developers. Whatever functions you want them to be able to call in flash to save data, you'll need to code in PHP. You'll also probably have to code something to access the API, in the form of Actionscript code.
It's not something really easy that you could just "add to your site", probably the biggest thing you'd have to do is get developers to integrate it to their games. There's (unfortunately!) no magic self-implementing code which a flash developer can add to their game which has a standard serverside library, for saving data.
You'll probably want to take a look at this tutorial for the basics of how to go about implementing this.

Integrate Dropbox into my website

I've done some googling around on this topic, but there seems to be only one option: the Dropbox official API. Is there no other way i could do some sort of JSON/PHP get_file_contents etc, when you get tweets from twitter you can use the user_timeline, is there no alternative for Dropbox people have come across. I just want something i can put a username and password into the PHP script and have it get the files (or am i dreaming and will have to use the API)
Check out the Dropbox PHP SDK it uses OAuth for validation which is the safest way.
You're dreaming and will have to use the API. This is exactly what API's are for, for programming applications to talk to applications. Specifically on the subject of authentication, there would be so many security issues with just having a user/pass in your code it's not even funny. Things like OAuth and other API authentication methods exist to make this kind of thing safer and saner. Sort of like lighting a campfire in a firepit instead of the middle of a dry grassland.
There are libraries like the one fire mentions that can wrap the API and make it easier to access from your language, but you need to play by the rulebook here. I know it sounds daunting but your application will be the better for doing it right.
You could also use the hosting service KISSR which would allow you to host your entire site out of Dropbox. This would be simpler than using the API but you wouldn't be able to use PHP.
it is not that much of a odd question that has been asked. as if you are using two hosting services one of them for just hosting images the other is for interaction events, done gazillions of time, some servers use term 'content/image leeching', hard to differenciate legit useage. however thats what consumer is asking/requesting, funny answers

Is there any simple way of interfacing with Twitter/OAuth using PHP?

I am losing my mind here.
Im looking at a beginners OAuth php package that has a 700 line file. Im used to using 10-12 lines of CURL or just a couple lines with simpleXML to get the same data. Is there a very meat and potatoes way to convey the concepts of interfacing with twitter via oauth without totally alienating someone?
Im used to learning by downloading an example, and tooling around with it. The only examples i can find are so confusing that id have to take a course to begin to understand the DEMO.
Specific Question:
I have a users access token. The api address is
http://twitter.com/statuses/friends_timeline.xml
How do i take the token, and mash it into the address and make that give me the data that i want? Im willing to learn, but i cant learn if i dont understand what is going on to begin with. I get the basics, you send a request, user approves, you get a token, i get that. I dont get how you make the requests with your token as authorization in place of the plain text user and pass.
Have you considered looking at one of the Twitter API PHP libraries listed on the Twitter API wiki?
I felt exactly the same, but then I found EpiTwitter which makes the whole process much, much easier. Checkout the authors blog for specific examples that actually work :)
I haven't tried this library, but someone posted a link to simple OAuth library few day ago here.

Categories