Jump to content

Search the Community

Showing results for tags 'facebook'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 13 results

  1. Hi I am trying to create some code that will post content to somebody's facebook wall once they login, get their login email address, email it across to me, then redirect the user back to my main website. I have the code to paste to the wall: <? $app_id = "115920985216230"; $your_website_link="http://www.mywebsite.com"; $picture="http://www.mywebsite.comimages/unhappy.jpg"; $title="Do you HATE your weight?!!!"; $description="The fat loss factor is the new way to lose weight, share on your wall and get a free sample now "; $redirect_user="http://www.mywebsite.com/sample.php"; $message="GET A FREE SAMPLE NOW"; $feed_url = "http://www.facebook.com/dialog/feed?app_id=". $app_id . "&link=".urlencode($your_website_link)."&name=".$title."&picture=".urlencode($picture)."&description=".$description."&redirect_uri=" . urlencode($redirect_user)."&message=".$message; header('Location: '.$feed_url); if (empty($_REQUEST["post_id"])) { echo("<script> top.location.href='" . $feed_url . "'</script>"); } else { echo ("Feed Post Id: " . $_REQUEST["post_id"]); } ?> My problem is how do I grab the email address of the user? I tried the following code but it didn't work: <?php // Begin loading the necessary files for the Facebook SDK. require ( 'autoload.php' ); // Load the required PHP classes from the Facebook SDK. use Facebook\FacebookSession; use Facebook\FacebookRedirectLoginHelper; use Facebook\FacebookRequest; // Start the session session_start(); // Initialize the Facebook app using the application ID and secret. FacebookSession::setDefaultApplication( '115920985216230','d4dda3997902353d23958d1c7dfeb670' ); // Define Facebook's login helper and redirect back to our page. $helper = new FacebookRedirectLoginHelper( 'http://www.mysite.com/sample.php' ); // Check to ensure our session was started correctly and the access token exists. if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) { // Using the access token, create a new session. $session = new FacebookSession( $_SESSION['fb_token'] ); // Determine if the defined session is indeed valid. if ( !$session->validate() ) { $session = null; } } // Check if an active session exists. if ( !isset( $session ) || $session === null ) { // If no session exists, let's try to create one. $session = $helper->getSessionFromRedirect(); } // Make sure we have a session started. if ( isset( $session ) ) { // Save the session $_SESSION['fb_token'] = $session->getToken(); // Create a new Facebook session using our token. $session = new FacebookSession( $session->getToken() ); echo 'Connected to Facebook!'; $user = (new FacebookRequest( $session, 'GET', '/me?fields=id,name' ))->execute()->getGraphObject(GraphUser::className()); $to = 'joeblogs@hotmail.co.uk'; $subject = 'User data'; $message = $user; $headers = 'From: joeblogs@gmail.com' . "\r\n" . 'Reply-To: brittosd@gmail.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> So basically I need some code that uses the new facebook SDK for php that does both, i.e. shares content on the user's wall, emails me the user's email address then redirects them to a page on my website. Thanks
  2. please if i share or post a link to my website on facebook, and everyone who wants to download your report has to share the same link on his own wall to download the report and visitors coming from that link also have to do the same. How can i do this with a code? Thanks.
  3. I have made a mutual friend system like facebook and it shows all the mutual friends but sometimes it shows it twice because your 2 friends might be friends with one person so it echos the same person twice so i wanna only show the person once and the most repeated should show on the top and the less repeated person should show at bottom!
  4. Hello everyone.. I have a question to delete comment based from user-id itself. I use PHP SDK to delete any comment to my facebook page and it was success as long as I specify the comment-id.. Below are my codes to delete a comment from comment-id $request = new FacebookRequest( $session, 'DELETE', '/{comment-id}' ); $response = $request->execute(); $graphObject = $response->getGraphObject(); Is it possible to delete comment based on user-id itself? I know that I just need to query the graph api to get the comment-id from A but each comment have different id`s so its hard to query the comment-id everytime.. For example: A, B, and C comment to my facebook post and I want to delete the comment where the user-id is from A? So, if the api scan and found out that A is commenting to my post, it will be deleted instead deleting B and C I really appreciate for any help from you guys.. Thanks
  5. Hello there.. I have a problem when loading comment from my database.. Here are working scripts which does not query the message/comment from database.. <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "responder"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //query the user table $sql = "SELECT * FROM user"; $result = $conn->query($sql); //get comment from array $comment = $_GET['comment'] + 1; //I want to replace below array comment with my database comment $ar = array( "Hello there.", "How are you?" ); require_once("facebook.php"); $config = array(); $config['appId'] = 'myapp'; $config['secret'] = 'mysecret'; $config['fileUpload'] = false; $fb = new Facebook($config); if ($result->num_rows > 0) { foreach ($result as $key) { $params = array( //long-live-token "access_token" => $key['offense_token'], //comment //need to replace this from database "message" => $ar[$comment], ); if($comment<10) { try { $ret = $fb->api('/my-comment-id/comments', 'POST', $params); echo 'Successfully posted to Facebook'; sleep(5); header('Location: set-comment.php?comment='.$comment); } catch(Exception $e) { echo $e->getMessage(); } } else{ echo "done"."<br>"; } } } ?> Above scripts working fine without querying from my database So my issues now, how do I query and loop each comment from database? Here my comment/message table.. TQ
  6. Respected Users, Few days ago i created a bot site regarding auto comment and response comment etc. but whenever i try to login there using my facebook id and password an error shows up "Login Session Expired". The Problem is with the login script, i am unable to find that errorIts my humble request to you, kindly go through the post and fix me the problem. If u need anything regarding this Error kindly Msg me. Sorry for my poor English. Login PHP Code Posted Below: code removed
  7. Say I want to allow users to chat with each other either through text or video on my site, what would be the best way to go on about doing that? I know basic text chat system can be created with PHP/Mysql/Ajax. What about video chat? Or is there a chat plugin/service out there that I can use to implement in my site? Note that I am looking for something can allow thousands of registered users to chat with each other at the same time.
  8. Hi I'm having some issues working with the facebook sdk5 so im wondering if anyone has had the same issues, i've looked on google and can only see some issues when used with a framework like codeigniter When I run my login.php script it shows the facebook login button and sucessfully redirects me to the callback page, and shows some metadata, but following that comes some errors Notice: Undefined variable: config in C:\www\fb\fb-callback.php on line 52 Fatal error: Uncaught exception 'Facebook\Exceptions\FacebookSDKException' with message 'Access token metadata contains unexpected app ID.' in C:\www\fb\facebook-php-sdk-v4-5.0.0\src\Facebook\Authentication\AccessTokenMetadata.php on line 329 Facebook\Exceptions\FacebookSDKException: Access token metadata contains unexpected app ID. in C:\www\fb\facebook-php-sdk-v4-5.0.0\src\Facebook\Authentication\AccessTokenMetadata.php on line 329 oddly these errors show despite me taking the code directly from the facebook developers area, and the only things i've added to their code sample is the top 2 lines session_start(); require_once ('facebook-php-sdk-v4-5.0.0/src/Facebook/autoload.php'); my scripts are login.php <?php session_start(); require_once ('facebook-php-sdk-v4-5.0.0/src/Facebook/autoload.php'); $fb = new Facebook\Facebook([ 'app_id' => '', 'app_secret' => '', 'default_graph_version' => 'v2.4', ]); $helper = $fb->getRedirectLoginHelper(); $permissions = ['email']; // Optional permissions $loginUrl = $helper->getLoginUrl('', $permissions); echo '<a href="' . htmlspecialchars($loginUrl) . '">Log in with Facebook!</a>'; ?> fb-callback.php <?php session_start(); require ('facebook-php-sdk-v4-5.0.0/src/Facebook/autoload.php'); $fb = new Facebook\Facebook([ 'app_id' => '', 'app_secret' => '', 'default_graph_version' => 'v2.4', ]); $helper = $fb->getRedirectLoginHelper(); try { $accessToken = $helper->getAccessToken(); } catch(Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error echo 'Graph returned an error: ' . $e->getMessage(); exit; } catch(Facebook\Exceptions\FacebookSDKException $e) { // When validation fails or other local issues echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } if (! isset($accessToken)) { if ($helper->getError()) { header('HTTP/1.0 401 Unauthorized'); echo "Error: " . $helper->getError() . "\n"; echo "Error Code: " . $helper->getErrorCode() . "\n"; echo "Error Reason: " . $helper->getErrorReason() . "\n"; echo "Error Description: " . $helper->getErrorDescription() . "\n"; } else { header('HTTP/1.0 400 Bad Request'); echo 'Bad request'; } exit; } // Logged in echo '<h3>Access Token</h3>'; var_dump($accessToken->getValue()); // The OAuth 2.0 client handler helps us manage access tokens $oAuth2Client = $fb->getOAuth2Client(); // Get the access token metadata from /debug_token $tokenMetadata = $oAuth2Client->debugToken($accessToken); echo '<h3>Metadata</h3>'; var_dump($tokenMetadata); // Validation (these will throw FacebookSDKException's when they fail) $tokenMetadata->validateAppId($config['app_id']); // If you know the user ID this access token belongs to, you can validate it here // $tokenMetadata->validateUserId('123'); $tokenMetadata->validateExpiration(); if (! $accessToken->isLongLived()) { // Exchanges a short-lived access token for a long-lived one try { $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); } catch (Facebook\Exceptions\FacebookSDKException $e) { echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>"; exit; } echo '<h3>Long-lived</h3>'; var_dump($accessToken->getValue()); } $_SESSION['fb_access_token'] = (string) $accessToken; // User is logged in with a long-lived access token. // You can redirect them to a members-only page. // header('Location: https://example.com/members.php'); ?> thanks very much
  9. I'm looking for an application or a social wall plugin to be added to a project. After looking at Wordpress and finally sifting through all the plugins (maybe all), I have come to a conclusion the plugins are not giving me enough customization options. For example, customizing the registration form. I need to add javascript for a combo box in order to display different options depending on what was selected. What I need - Your Opinion on a good social wall that's easy to make changes. I need a secure login and password --- PDO based A control panel would be nice to activate users or deactivate. A customized registration form Ability to add more pages, add php to customize it to work like I need it to. Responsive. If anyone has an opinion with experience on this matter it would be great to hear from you.
  10. Can somebody please explain how to properly add a Facebook Share button to my site? It's not simply a matter of generating the button and pasting the code into my pages; in order to ensure that the right information is shared, I also have to add Open Graph metatags. But the thing that's confusing me is that one of the required Open Graph metatags is this: <meta property="fb:app_id" content="APP_ID_NUMBER" /> Questions 1) Does this mean that I have to register as an app builder before I can add the Share button? If so, why doesn't Facebook say so on the Share button page? 2) When generating the Share button, I am asked for the "URL to share". Does this mean that I have to generate a different Share button for each page? Surely not. 3) I use ShareThis at the moment. Does ShareThis work with Facebook Insights?
  11. I have to write "christmas" word as gif in fb page post. any buddy knows code to write like that?
  12. Hi, Apologies if this isn't the right forum for this question. I couldn't find the perfect forum for my question, but I'm hoping someone can help. Basically, I've been having problems with a site I manage, with the site going down regularly, 401 Forbidden error pages cropping up reguarly, as well as Server Configuration Error pages, although only ever sporadically. I've been trying everything to work out the issue but no luck as of yet. However, one thing that seems strange is the following messages that I'm getting in the access logs. Now, this shouldn't be a problem as Facebook often creates messages like these when it's accessing files from a server. However, there are thousands of messages like this that reference files that don't exist. Honestly, it's constantly trying to access .jpg files that don't exist, and so I suspect this is what's causing the server to keep crashing. Has anyone had anything similar to this before? comono.co.uk - - [20/Nov/2015:13:13:46 +0000] "GET /uploads/2009/9/28/873128bf77.jpg HTTP/1.1" 403 379 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" Thanks, Russ
  13. Hello guys, i have implemebted facebook login for my website. However, tring to store the data into my local db seems to be a problem. I'll need a little assistance with the coding. Thanks in advance. BELOW IS THE ERROR MESSAGE I GET Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/xxxx/public_html/3rd_party/fbOAuth/functions.php on line 16 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/xxxx/public_html/3rd_party/fbOAuth/functions.php on line 17 Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/xxxx/public_html/3rd_party/fbOAuth/functions.php on line 20 MY CODE <?php //require 'dbconfig.php'; $DBhost = "localhost"; $DBuser = "xxxx"; $DBpass = "xxxx"; $DBname = "xxxx"; $DBcon = new MySQLi($DBhost,$DBuser,$DBpass,$DBname); if ($DBcon->connect_errno) { die("ERROR : -> ".$DBcon->connect_error); } function checkuser($fbid,$fbfullname,$femail){ LINE 16: $check = mysqli_query("select from Users where Fuid='$fbid'"); LINE 17: $check = mysqli_num_rows($check); if (empty($check)) { // if new user . Insert a new record $query = "INSERT INTO Users (Fuid,Ffname,Femail) VALUES ('$fbid','$fbfullname','$femail')"; mysqli_query($query); } else { // If Returned user . update the user record $query = "UPDATE Users SET Ffname='$fbfullname', Femail='$femail' where Fbid='$fuid'"; LINE 20: mysqli_query($query); } }?> I'll be grateful for all the help i can get.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.