OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
facebook
/
backup
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/14/2024 07:24:26 AM
rwxr-xr-x
📄
accessTest.php
1.06 KB
10/10/2024 10:19:30 AM
rw-r--r--
📄
credential.json
345 bytes
10/10/2024 10:19:30 AM
rw-r--r--
📄
facebook_callback.php
2.63 KB
10/10/2024 10:19:30 AM
rw-r--r--
📄
facebook_share.php
2.41 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
index.php
726 bytes
10/10/2024 10:19:31 AM
rw-r--r--
📄
link_post.php
1.34 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
permissionTest.php
1.19 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
postTest.php
1.73 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
post_to_page.php
2.17 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
share_facebook.php
2.41 KB
10/10/2024 10:19:31 AM
rw-r--r--
📄
share_post.php
885 bytes
10/10/2024 10:19:31 AM
rw-r--r--
Editing: share_facebook.php
Close
<?php // Replace with your Facebook App ID and App Secret $app_id = '474369069647686'; $app_secret = '60d149a294b51023d9f611e7549c0fb2'; $page_id = '379860695210422'; // The page ID where you want to post $link = 'https://knoblycream.com/'; // The link you want to share $message = 'Visit the above link..'; // Optional message // Step 1: Obtain short-lived user access token $url = "https://graph.facebook.com/oauth/access_token"; $params = [ 'client_id' => $app_id, 'client_secret' => $app_secret, 'grant_type' => 'client_credentials', ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); $response = curl_exec($ch); curl_close($ch); $token_info = json_decode($response, true); echo "<pre>"; print_r($token_info); echo "</pre>"; $short_lived_token = $token_info['access_token']; // Step 2: Exchange short-lived token for long-lived page access token $url = "https://graph.facebook.com/v12.0/oauth/access_token"; $params = [ 'grant_type' => 'fb_exchange_token', 'client_id' => $app_id, 'client_secret' => $app_secret, 'fb_exchange_token' => $short_lived_token, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); $response = curl_exec($ch); curl_close($ch); $token_info = json_decode($response, true); echo "<pre>"; print_r($token_info); echo "</pre>"; $page_access_token = $token_info['access_token']; // Step 3: Post to Facebook page $url = "https://graph.facebook.com/$page_id/feed"; $data = [ 'link' => $link, 'message' => $message, 'access_token' => $page_access_token, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); echo "<pre>"; print_r($result); echo "</pre>"; // Step 4: Check result if (isset($result['id'])) { echo "Link shared successfully. Post ID: " . $result['id']; } else { echo "Failed to share link: " . $result['error']['message']; } ?>