OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
reader
/
facebook
/
new_folder
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
accessTest.php
601 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
composer-setup.php
57.04 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
composer.json
64 bytes
03/03/2025 08:20:44 AM
rw-r--r--
📄
composer.lock
2.81 KB
03/03/2025 08:20:44 AM
rw-r--r--
📄
composer.phar
2.86 MB
03/03/2025 08:20:44 AM
rw-r--r--
📄
configuration.txt
79 bytes
03/03/2025 08:20:44 AM
rw-r--r--
📄
credential.json
556 bytes
03/03/2025 08:20:45 AM
rw-r--r--
📄
function.php
7.44 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
get_facebook_access_token.php
1.94 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
index.php
370 bytes
05/19/2025 10:07:15 AM
rw-r--r--
📄
permissionTest.php
1.26 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
postTest.php
1.24 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
post_to_page.php
2.23 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
share_facebook.php
1.61 KB
05/19/2025 10:07:15 AM
rw-r--r--
Editing: get_facebook_access_token.php
Close
<?php // Facebook App credentials $credentials = json_decode(file_get_contents('credential.json'), true); $appId = $credentials['app_id']; $appSecret = $credentials['appSecret']; $redirectUri = 'https://knoblycream.com/testing/share_facebook.php'; // Replace with your redirect URI // Authorization endpoint $dialogUrl = 'https://www.facebook.com/v12.0/dialog/oauth'; $params = [ 'client_id' => $appId, 'redirect_uri' => $redirectUri, 'scope' => 'publish_actions', // Permissions requested 'response_type' => 'code', ]; // Redirect user to Facebook for authentication $authUrl = $dialogUrl . '?' . http_build_query($params); header('Location: ' . $authUrl); exit(); // After user grants permission, Facebook redirects back with 'code' parameter in the URL // Handle the callback (e.g., in your redirect URI file) if (isset($_GET['code'])) { // Exchange 'code' for access token $tokenUrl = 'https://graph.facebook.com/v12.0/oauth/access_token'; $tokenParams = [ 'client_id' => $appId, 'client_secret' => $appSecret, 'redirect_uri' => $redirectUri, 'code' => $_GET['code'], ]; // Initialize cURL session $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $tokenUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($tokenParams)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute cURL request $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { // Decode JSON response $responseData = json_decode($response, true); if (isset($responseData['access_token'])) { echo 'Access Token: ' . $responseData['access_token']; } else { echo 'Error in obtaining access token.'; } } // Close cURL session curl_close($ch); } ?>