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


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 20 results

  1. This code is taken from http://itfeast.blogspot.in/2013/08/php-convert-timestamp-into-facebook.html How would you actually show this on a page? Say I have a mysql table with date column and I would like to insert the results of this code in there and as well as show it on page, how would that be done? $today = time(); $createdday= strtotime($post['created']); //mysql timestamp of when post was created $datediff = abs($today - $createdday); $difftext=""; $years = floor($datediff / (365*60*60*24)); $months = floor(($datediff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($datediff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); $hours= floor($datediff/3600); $minutes= floor($datediff/60); $seconds= floor($datediff); //year checker if($difftext=="") { if($years>1) $difftext=$years." years ago"; elseif($years==1) $difftext=$years." year ago"; } //month checker if($difftext=="") { if($months>1) $difftext=$months." months ago"; elseif($months==1) $difftext=$months." month ago"; } //month checker if($difftext=="") { if($days>1) $difftext=$days." days ago"; elseif($days==1) $difftext=$days." day ago"; } //hour checker if($difftext=="") { if($hours>1) $difftext=$hours." hours ago"; elseif($hours==1) $difftext=$hours." hour ago"; } //minutes checker if($difftext=="") { if($minutes>1) $difftext=$minutes." minutes ago"; elseif($minutes==1) $difftext=$minutes." minute ago"; } //seconds checker if($difftext=="") { if($seconds>1) $difftext=$seconds." seconds ago"; elseif($seconds==1) $difftext=$seconds." second ago"; } echo " | ".$difftext;
  2. AkbarReaper

    Mutual Friend System

    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!
  3. 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
  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. I have 100 Active Facebook access tokens. For each account I have more than one access token. I want to keep only one token for each account and want to delete the others. And i don't want to do this manually so please post a PHP script which check all the tokens and keep only one active token for each account. These tokens are present in a folder named "tok3ns".
  6. I have a facebook app working at https://apps.facebook.com/inboxcupid/ When trying to log in from a mobile device, the GetUser method always return 0. It actually creates a redirect loop as the page is constantly redirected to login, return to the app page and then back to login. It's imperative to know that this code works just fine on a desktop but fails on mobile. Here is my code: require_once ('facebook.php'); $config = array( 'appId' => '*****', 'secret' => '*****' ); // Create the Facebook object $facebook = new Facebook($config); $login_params = array( 'canvas' => 1, 'scope' => 'basic_info, user_about_me, user_birthday, user_relationships, user_relationship_details, user_location, user_photos', 'fbconnect' => 1, ); $user = $facebook->getUser(); if($user) { try { $permissions = $facebook->api("/me/permissions"); if( !array_key_exists('basic_info', $permissions['data'][0]) || !array_key_exists('user_location', $permissions['data'][0]) || !array_key_exists('user_about_me', $permissions['data'][0]) || !array_key_exists('user_birthday', $permissions['data'][0]) || !array_key_exists('user_relationships', $permissions['data'][0]) || !array_key_exists('user_relationship_details', $permissions['data'][0]) || !array_key_exists('user_photos', $permissions['data'][0]) ) { $login_url = $facebook->getLoginUrl($login_params); echo "<script" . " type='text/javascript'" . ">top.location.href = '$login_url';</script>"; } } catch(FacebookApiException $e) { $login_url = $facebook->getLoginUrl($login_params); echo "<script" . " type='text/javascript'" . ">top.location.href = '$login_url';</script>"; error_log($e->getType()); error_log($e->getMessage()); } } else { $login_url = $facebook->getLoginUrl($login_params); echo "<script" . " type='text/javascript'" . ">top.location.href = '$login_url';</script>"; } If anyone can help me figure it out I'll be thankful.
  7. brittosd

    Facebook API Problem

    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
  8. I just started working with my first .htaccess RewriteRule because when submitting a facebook app, it must end with either a trailing slash or be a dynamic URL. My domain already is used for another project so I put my app into a sub-directory so it looks like this http://www.example.com/app/index2.html I'm trying to convert it to be in this format http://www.example.com/app/fbapp/ I can't use app's sub-directory as index.html or index.php which is already used outside of a facebook with Google Ads, since Google Ads are illegal to be used on facebook, I created a copy of the index.html called index2.html without any Google ads on it. I started messing around with .htaccess and I got it semi-working but in Google Chrome it seems to detect the URL as being a folder and starts loading the stylesheets and javascript scripts from the fake virtual directory assuming that fbapp is a directory when it should be app/file.xxx instead of app/fbapp/file.xxx Here is what I got so far I still don't understand how to use Rewrite Condionals but from my understanding if the RewriteCond is triggered it will run the line right under it, otherwise it will skip it somehow and go to the third line which works fine as long as it's not a script/image/stylesheet/etc... RewriteEngine on RewriteCond $1 !^(favicon\.ico|favicon\.png|robots\.txt|css|js) [NC] RewriteRule ^(.*)$ $1 [E=BASE:%1] RewriteRule ^fbapp index2.html [E=BASE:%1]
  9. 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
  10. Hi, I'm trying to pass a variable from my php script on the page into the og;metadata, but on the timeline all that is shown is the standard html metadata, am I using the correct php code to call the variable so that it shows up on the timeline? <meta property="og:title" content="<?php $_GET['$title']; ?>"/> the title variable comes from here; $title = urlencode("Take The Test!"); Any help on this is much appreciated, Gareth
  11. Hello, I have a project to create facebook page. I would make a tiny version of our website in the facebook fan page. In this facebook page, I need to implement an affiliate system (each member who brings us a new member earns 1 point). To do this, I need to "track" visitors. With normal affiliate systems, it's easy! Just put a parameter in the url. eg mywebsite.com/affiliate.php?id=378 But in the Facebook page, it is apparently not possible? So I ask myself two questions: 1) Is it better to use an existing facebook application that allows you to create a website in a facebook page? In this case how to track visitors for my affiliate sytem? 2) Or is it better to create a new facebook application from A to Z which will clone my website in facebook page? In this case how to track visitors for my affiliate sytem? Thank you in advance for your help.
  12. I want a PHP code to find the userID of a Facebook Account using Access Token. My form is like this:
  13. 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('http://192.168.0.4/fb/fb-callback.php', $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
  14. 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.
  15. Hello everyone, I'm new here My website was working fine until a few days ago, Up until then my str_replace('s130x130', 's800x800') and str_replace('_s', '_o') solved the picture thing. Now the images are broken (or very small) and I can find no documentation on how to enlarge the pictures. Thus my question: how do I retrieve larger pictures from the Facebook PHP SDK? Code foreach($pagefeed['data'] as $post) { if ($post['type'] == 'status' || $post['type'] == 'link' || $post['type'] == 'photo') { if ($post['type'] == 'photo') { echo "<div class='col-md-6 col-sm-6'>"; echo "<div class='thumbnail'>"; echo "<img src=" . str_replace('s130x130', 's800x800', str_replace('_s', '_o', $post['picture'])) . " />"; echo "<div class='caption'>"; echo "<sup>Geplaatst op: " . date("d-m-Y, (strtotime($post['created_time']))) . "</sup>"; if (empty($post['message']) === false) { echo "<p><span class='glyphicon glyphicon-comment'></span> " . $post['message'] . "</p>";} echo "</div>"; echo "</div>"; echo "</div>"; $i++; } } } Thanks in advance!
  16. 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?
  17. 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.
  18. Selva_kumar

    Fb Comments tricks

    I have to write "christmas" word as gif in fb page post. any buddy knows code to write like that?
  19. 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.
  20. 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 173.252.88.88 - - [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
×

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.