OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
testing
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
11/28/2024 11:03:35 AM
rwxrwxr-x
📄
accessTest copy.php
657 bytes
10/07/2024 05:44:48 AM
rw-r--r--
📄
accessTest.php
657 bytes
10/08/2024 07:28:15 AM
rw-r--r--
📁
backup
-
10/07/2024 05:44:52 AM
rwxr-xr-x
📄
composer-setup.php
57.07 KB
10/07/2024 05:44:51 AM
rwxr-xr-x
📄
composer.json
64 bytes
10/07/2024 05:44:51 AM
rw-r--r--
📄
composer.lock
2.81 KB
10/07/2024 05:44:51 AM
rw-r--r--
📄
composer.phar
2.86 MB
10/07/2024 05:44:52 AM
rwxr-xr-x
📄
configuration.txt
79 bytes
10/07/2024 05:44:51 AM
rw-r--r--
📁
cream
-
10/07/2024 05:39:15 AM
rwxr-xr-x
📄
credential copy.json
556 bytes
10/07/2024 05:44:51 AM
rw-r--r--
📄
credential.json
556 bytes
10/07/2024 05:44:51 AM
rw-rw-rw-
📄
db_connect.php
341 bytes
10/07/2024 05:44:51 AM
rw-r--r--
📄
function.php
18.87 KB
10/10/2024 09:04:44 AM
rw-r--r--
📄
get_facebook_access_token.php
1.94 KB
09/04/2024 05:58:04 AM
rw-r--r--
📄
index.php
476 bytes
10/08/2024 07:28:06 AM
rw-r--r--
📄
navbar.php
1.63 KB
10/07/2024 11:24:58 AM
rw-r--r--
📁
new_folder
-
10/07/2024 05:44:53 AM
rwxr-xr-x
📄
new_index.php
10.08 KB
10/10/2024 08:40:32 AM
rw-r--r--
📄
permissionTest.php
1.31 KB
09/04/2024 05:58:04 AM
rw-r--r--
📄
postTest.php
3.43 KB
10/08/2024 07:28:28 AM
rw-r--r--
📄
post_to_page.php
2.29 KB
09/04/2024 05:58:04 AM
rw-r--r--
📄
share_facebook.php
2.02 KB
10/08/2024 07:28:28 AM
rw-r--r--
📄
sidebar.php
3.08 KB
10/07/2024 11:28:08 AM
rw-r--r--
📄
update_fb_pages.php
347 bytes
10/10/2024 09:05:33 AM
rw-r--r--
📁
vendor
-
07/20/2024 07:09:34 AM
rwxr-xr-x
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); } ?>