php - Using Laravel 4 Facebook Login compare profile link when login

852

I'm wondering if anyone can help me, I am building aLaravel-4 application that uses theFacebook API. Currently I've managed to gain a connection to facebook and can login to the application.

However I want to control where the users go based on if there facebook profile link exists in thedatabase. Currently I've got a form that takes theurl of their profile and inserts it into the DB.

This is my facebook profile link:

https://www.facebook.com/profile.php?id=100006760337073

However when I make a request to facebook I get this response:

array(11) {
        ["id"]=> string(16) "1536122286623101" 
        ["email"]=> string(16) "[email protected]" 
        ["first_name"]=> string(4) "Jack" 
        ["gender"]=> string(4) "male" 
        ["last_name"]=> string(8) "Coldrick" 
        ["link"]=> string(61) "https://www.facebook.com/app_scoped_user_id/1536122286623101/" ["locale"]=> string(5) "en_US"
        ["name"]=> string(13) "Jack Coldrick" 
        ["timezone"]=> int(1) 
        ["updated_time"]=> string(24) "2014-09-05T16:35:17+0000" 
        ["verified"]=> bool(true) 
} 

The['link'] does not match theprofile link in the url bar so my logic won't work because I am comparing these two. I'm wondering what the best way would be to store the users profile in thedb and when they login check to see if they exist in thedb.

Any help is much appreciated.

This is mycontroller

public function handleAddFacebook(){
        //Make an entry into the winners table of the DB
        $facebookWinner = new FacebookWinner();
        $facebookWinner->profile_link = Input::get('link');
        $facebookWinner->origin = Input::get('origin');
        $facebookWinner->destination = Input::get('destination');
        $facebookWinner->win_date = date('Y-m-d');
        $facebookWinner->save();
        return View::make('admin.dashboard');           
    }

Is there any way I could use theInput::get('link') to request the users id from facebook?

People are also looking for solutions to the problem: php - Generating symfony2 form on Bootstrap popover is slow

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.