Facebook cookie access through PHP codeigniter - php

I want to get the email address of a user when he visits my site by checking if he currently has a facebook session going on in the browser. If he has then is there a way I can extract his email address from the facebook cookie and store it in my website's database for future reference.
Please note that I don't want to create a Facebook App just want to extract the email address of the user from their cookie. I'll create a Facebook login later but as of now I just want to keep track of any visitor as well if possible for example by the above scenario.
I couldn't find it in their developer documentation hence I'm asking the forum. I'm using Codeigniter for PHP srcipting on my website and its basically a E-commerce website.
Any javascript or Jquery solutions will work as well!!!!

No. This is not possible. If anybody could get everybody's email without asking then people would be even more angry at Facebook.

Related

Multiple facebook accounts within a single website

I am developing a site in php. And in this site, I have to add multiple Facebook accounts but i have no idea about it. Please help me.
Thankyou
Its not that much difficult Facebook has built-in login-with-facebook facility.. you just need to ensure the SDK of facebook using your app you can make user record in you db and also can make them login verify and all the stuff a developer wanter here see this

Sign in with fb or twitter

For a project I am working on, I think having the functionality to sign in with facebook/ twitter would be beneficial.
I have some design theory to iron out.
When the user first logs into the website using either twitter or facebook, I'll get their email and other relevant information and store it in the database where a normal signed up user would be stored.
When they return, they would log in with twitter/ fb again and it would locate the information in the database and not add it again.
If anyone tried to sign up with the email address provided by either of these services, an email would be sent to the email address to confirm it is them and then they could generate just a password to allow them to log in with information already stored.
I could they link other data on the website to the userid I have stored for them throughout the entire process.
So my query would be whether this is the correct way to go about this?
How have others used these types of login api's and then binded them to on site data?
I believe this to be a reasonable question but if I have placed it in the wrong section, please feel free to move it!
Thanks.
well, everything should be written here http://developers.facebook.com/ also try using php sdk for facebook api, for twitter here https://dev.twitter.com/
Create an app in both fb and twitter, take the access token and access token secret
You should download all the files necessary and then configure them as is written in manual, if you will have trouble connecting to them write me a message to my mail(jurijs.nesterovs#inbox.lv) i'll try to help
Have done that before myself for my site. It was Fb/Twitter/Google. I bet thats the best thing to do. Google's API is the easiest out of these 3. Twitter was hard for me since I dont use OOP and all the libraries out there was OOP.
And about your design, my site was made not to not allow the user to join with the same email again. If they have joined using Facebook with an email, when they try to join using twitter with the same email, I would tell the user that they are already registered using Facebook.

in my php page, I need the visitor facebook information.. possible?

I see some website detect my facebook name and offer a like button so I can the page I'm visiting. Can that be done in php? if not, how then?
Thanks
Facebook offers widgets for that matter, you can copy paste the code from the Facebook developer site: https://developers.facebook.com/docs/reference/plugins/like/
To get a visitor's name, tou could use Facebook javascript API https://developers.facebook.com/docs/reference/javascript/. You'll need to create an application and the user will need to authorize it before you're able to get any information. There are obvious security reasons why you can't get your visitor's name.

How do I use cookies to let visitors access to the downloads page of my website

I want visitors to my website to fill out a contact form before they can access the downloads page. I am looking for online resources or examples. The only ones I can find are username and password authentication which I don't need. I am hoping to do it in PHP. At the moment my Contact form emails me their details but anyone can access the downloads page.
Thank you
You're not giving us much to go on!
Based on your tags I assume your developing in php. This tutorial should give you what you need Website Authentication - a simple PHP sample

How can I build an API in PHP

Hello I am looking to build a basic API and application/apps system on my social network something like Facebook or other sites have, my site is in php/mysql. Here are some questions.
1)
Basically what I want to do is give a user a API key and secret. After I have these how can I use them in my php app to authenticate a user request which would come from there server?
2)
I can basically build an API to send a request to my server with CURL and get the result back to the page in XML or JSON or whatever, the problem is when sending the request the user would have to know the user ID they want to send to lookup data against, this is fine for an API but I am wanting to have an Apps section where the user's app site would be using the API and would be loaded into my site in the app section with an iframe, the problem is, I need to find a good way to make it where a logged in user on my site can go to the app section and go to an app and there username should be available to that page loaded in the iframe. Facebook and myspace do this somehow and many other sites; I am lost how to get around this hurdle.
Any help on any of this is really appreciated, thank you
Update:
I just had an idea, if I require a cookie to be set when a user visit's my site, then they would have a cookie and it could hold there User ID, then my API script could look for that cookie to exist and grab it's value?
If you plane on using an IFRAME, then no, your API hosted on a separate website (the website inside the IFRAME) would not be able to grab the cookie. The cookie is only visible on the website that it was set for.
I have only used Facebook API with the FBML (not the IFRAME,) but all they do their is basically replace what's in the page with the info that the "tag" is calling. I'm not sure if there is a better way, but you could possibly call a page on the app's server (say the app is hosted at http://example.com/app/, and you called http://example.com/app/?id=28318&name=John%20Maguire,) and have your API code handle it and turn it into a variable?
Maybe you should look into the source code of the Facebook API client.

Categories