Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7062037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:32:46+00:00 2026-05-28T04:32:46+00:00

I am implementing facebook registration in my Yii site.. I setup application. For registration,

  • 0

I am implementing facebook registration in my Yii site.. I setup application. For registration, in one step, we need to decode facebook users data, send by facebook. Facebook provide the code for decoding information. I implement this code, but having error like:

” Fatal error: Call to undefined function base64_url_decode() in C:\wamp\www\cma\app\protected\controllers\SiteController.php on line 259 “

My code snippet is

public function actionFacebookLogin()
    {
        //error_reporting(E_ALL);
        //ini_set("display_errors", 1);

        $signed_request = $_POST['signed_request'];
        Yii::log("actionFacebookLogin called.....");
        //list($encoded_sig,$payload) = explode('.', $signed_request,2);

        list ($encoded_sig,$payload) = explode('.', $signed_request,2);

        Yii::log('in the list');
        //decode the data
        $sig =  base64_url_decode($encoded_sig);
        $data = json_decode(base64_url_decode($payload), true);

        if(strtoupper($data['algorithm'])!= 'HMAC-SHA256'){
            Yii::log('Unkonwon alogorithm.Expected HMAC-SHA256');
            //return null;
        }


        //check sig
        $expected_sig = hash_hmac('sha256', $payload, $secret,$raw=true);
        if($sig !== $expected_sig){
            Yii::log('Bad Signed JSON Signature');
            //return null;
        }
        //return $data;
        $this->render('facebookview',array('response'=>$data));

    }

      public function base64_url_decode($input)
        {
        return base64_decode(strtr($input, '-_', '+/'));
        }

I implement this code in my siteController…

Can anyone help to find what is wrong with the code..
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:32:47+00:00Added an answer on May 28, 2026 at 4:32 am

    Thanks for your help!!! But the problem solved…

    I placed, function base64_url_decode into model creating new util class and named as static function base64_url_decode. I called the function as util::base64_url_decode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a Facebook Registration Plugin. While in development locally and on one
I'm having trouble implementing this step: Given I am logged in as a Facebook
I'm with some problems implementing my first application with Login with Facebook. The user
I am implementing a Facebook application that shown as a tab in a fan
I am implementing the Facebook Registration plugin on a website and was wondering if
I'm implementing the Facebook registration widget into our web app, and we've got a
We're implementing a Facebook-connect mechanism to allow users to sign up into our system.
I am going to be implementing the facebook application into my project, but I've
We are implementing a voting-system inside an facebook app. The users are able to
in my rails web application I am implementing Facebook connectivity. I want that whenever

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.