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

  • SEARCH
  • Home
  • 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 6557321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:03:33+00:00 2026-05-25T13:03:33+00:00

i am using php sdk. here is my php code require ‘src/facebook.php’; $facebook =

  • 0

i am using php sdk. here is my php code

require 'src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => '123456',
  'secret' => '123456abcdef',
));

// Get User ID
$user = $facebook->getUser();

//echo "-----".$user;

if ($user) {
  try {
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    $user = null;
  }  

    //print_r($user_profile);
    $token = $facebook->getAccessToken();
    //echo $token;
    // store token

    if ($user_profile['id'] && $token) {
    $useradd = mysql_query("insert into fbdata (id,name,token) values ('".$user_profile['id']."','".$user_profile['name']."','".$token."')");
    if ($uyeekle)
    echo "Data added";
    }
}


if (!$user) {
    $args['scope'] = 'offline_access,read_stream,publish_stream';
    $loginUrl = $facebook->getLoginUrl($args); ?>
<a href="<?php echo $loginUrl ?>">Facebook Login</a>
<?php } ?>

facebook redirect to my website with code parameter, not access token. and it s not looking like access token format. there is no | char. But i will try to upload a video with this code it works.

require 'src/facebook.php';


$facebook = new Facebook(array(
  'appId'  => '123456',
  'secret' => '123456abcdef',
));
$facebook->setFileUploadSupport(true);

$url = "https://graph-video.facebook.com/me/videos?title=abc&description=desc&access_token=ABAD........AZDZD";


$attachment = array(
'description' => 'desc',
'title' => 'abc'
);


$attachment["file"] = '@' . realpath("123.mp4");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);

$data = curl_exec($ch);
echo $data;

this code returns video id. then i want to get video info from that addresss
https://graph.facebook.com/123456?access_token=ABAD…&#8230;..AZDZD

but its always saying false. where is my mistake?

  • 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-25T13:03:34+00:00Added an answer on May 25, 2026 at 1:03 pm

    Redirecting with a code instead of an access token is expected behavior, confirmed by the Facebook Authentication docs. When using server-side auth (PHP SDK), Facebook will redirect to http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER. You then have to resolve this code into an access token yourself (which you can do just by calling $facebook->getAccessToken()). And as you say, you can then use this access token (not the code from the redirect) to make API calls.

    If you’re using the Facebook PHP SDK, you should just use that to make those API calls. I’m not sure about the specifics for uploading videos, but it should look something like this:

    $facebook = new Facebook(array(
        'appId'  => '123456',
        'secret' => '123456abcdef',
        'fileUpload' => true,
    ));
    
    $attachment = array(
        'description' => 'desc',
        'title'       => 'abc',
        'file'        => '@' . realpath("123.mp4");
    );
    
    $result = $facebook->api('/me/videos', 'POST', $attachment);
    var_dump($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to post a status update using facebook php sdk. Code posted below. As
I am new to facebook development. I am using PHP-FBML with Graph API. Edited:
I am using facebook PHP SDK to access the friend list include_once(../fb-config.php); include_once(../facebook.php); try{
I am developing a facebook application using php-sdk. i want to take some extended
I'm using the PHP SDK from facebook in my own application. When I retrieve
I'm using the PHP SDK for facebook connect. Now, I can log people in
I'm using the PHP SDK from facebook in my application. When I'm publishing a
I've been using PHP for too long, but I'm new to JavaScript integration in
I'm new here. I have been trying to create a video capture app using
I have really simple few lines of Facebook app, using the new Facebook API:

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.