how to retrieve facebook page wall posts update in external site - javascript

I need to publish landing tab wall posts of a page on my website using php and javascript,can anybody tell me how to implement this ,as i thought it can be done with FQL via page table but there is no any related field i found.
thanks

Use the Graph API to retrieve posts for a page: https://graph.facebook.com/SmartDeals/posts
You can use either PHP and JavaScript to parse that JSON and display whatever you'd like.
The complete list of things you can retrieve for your page is documented under the Connections section at: http://developers.facebook.com/docs/reference/api/page

Related

How to convert JavaScript dynamic data into HTML and render?

We have developed a website and it uses JavaScript library to query database and display the data in HTML page. When you go to the website, you need to search for something in order to retrieve the data.
so by default website doesn't display any data and it needs users to perform action.
The search result data is not visible in HTML view source as it uses JavaScript.
So, the search engines have no visibility as to what our website used for and data used in order to redirect more visitors.
Secondly, I wonder how search bots/engine crawl the websites with non-static content and understand enough about the website to redirect users.
from what i see from your question what you need to do is send requests to your server to query data from your database and show it to you client in real-time.For that i would recommend that you use web sockets(such as socket.io) or AJAX so that you could update your website seamlessly
From what I have researched, crawlers actually don't read dynamic content. Instead, they use this technique called dynamic rendering.
Dynamic rendering has to do with the server itself. It checks each request and if it determines it to be a bot, then it will send static HTML content to the bot. Otherwise, it will send normal dynamic content to the user.
Also, google and other search engines make use of meta tags. With meta tags you can define a short description of the webpage which will oftentimes be shown in the search results page.
As for question in the title, you would need to send the search information to a server. From there, you would process the data server-side and send the results back to the client where JavaScript would render it based off of the results.
You should use AJAX for this.
Resources:
https://ignitevisibility.com/dynamic-rendering-seo-details-need-know/
https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX
https://developer.mozilla.org/en/docs/Web/HTML/Element/meta

Embed a Facebook Page Post including Comments

I've been looking at how to embed a Facebook Page Post using this documentation. I like the way this looks, but it doesn't allow for the comments to also be shown at the same time. My goal is to create a dashboard of page post and display it on a TV in the hallway. None of the posts have more than 10 comments so it wouldn't get out of hand. Is there a way to accomplis this using the api I linked, or do I need to spin up my own iframe to include the comments?
It appears the best way to list the comments of a Facebook page post is to use the Facebook Graph API. Here is a direct link to the comments API:
https://developers.facebook.com/docs/graph-api/reference/v2.5/object/comments

Accessing a public Facebook feed without logging in

I am working on a seemingly simple Facebook integration to allow my client (a local restaurant) to display their daily specials on their website. To make this work properly I need to sort through their posts, find the most recent post that has a certain string of characters (to distinguish from other posts they make), and display the post on the webpage. I know how to do this part but I am having trouble getting the data in the first place.
My question: How do I access the data for this Facebook page's posts? This needs to work
Without logging into Facebook
Preferably client-side
I would also like to use the JSON from the Graph API but I need an access token according to all the research I have done so far which would force me to go server-side. The Facebook social plugins are not specific enough to do what I want. Any help using the Graph API or another method to retrieve the page's posts is very much appreciated.

Grabbing facebook feed in website

I develop mobile websites for my clients. This particular client would like some facebook wall activity to be displayed on the website. I have looked into the facebook graph api and am getting confused on authentication.
I need the blah in https://graphs.facebook.com/clientsfacebookid/feed?access_token=blah
in order to grab the info i want. I read about authentication and all of that but it doesn't seem to serve my purposes.. For example a lot of the stuff I read about getting a token is related to creating apps and stuff - which is not what I'm trying to do. A lot of ways to authenticate redirect users to log in or grant access to the information but this also doesn't seem like it fits my scenario.
Should I just talk to my client and get them to send me an access code or set up some stream so I can grab an updated access code anytime I need it OR is there some built in functionality in the API that I could benefit from using.
Any thoughts?
P.S. I am trying to implement this via an ajax call in javascript.
Thanks!
What you'll need to do is create a Facebook App and have your client add this to their page. You can then get an OAuth token for this app and use it to query the client's feed. See the Facebook documentation for authenticating as an app for details.
It's actually far simpler if you just want to grab the data from the page. Create an App, but you don't need to add it to the actual page. You can generate an App Access Token by following the instruction on the Facebook Developer Website.
Then, all you need to do is call the Graph API with the generated access_token. E.g.:
https://graph.facebook.com/{page_id}/feed?access_token={app_access_token}
You can then use the data returned by Facebook to display selected posts from the page.
The Page Admin doesn't need to add the app to the page, and this method can be used to scrape any published page. The posts on Pages is public anyway, you just need an access_token to access the page.
If you want a simple way to learn and have an example of a working model try out fourgefeed.com its a simple framework with a simple to implement example kinda like jquery.

Rails 3 pulling data from another site

I have a client request on one of my projects where they want to be able to enter a url and have it pull in some information form the site who's url they entered and save it in the database.
So the user enters: http://www.example.com/2342342 and my controller visits that site, and gets the content of the first <h1>Tag</h1> on the site and saves this in the database. Is this possible? If so, how would I go about doing it? Would I use some rails commands to do it, or something else, like jQuery?
Nokogiri is a great parser and can work directly with an url.
So two steps there:
Instantiate a Nokogiri object with the url as param
Parse the html page to get what you expect
Find instructions here: http://nokogiri.org/tutorials/parsing_an_html_xml_document.html
Because you'll work with another website, keep in mind two advice:
wrap your queries so that you can rescue if the website is down
consider using ajax request because it could be long
I would checkout the Railscast here:
http://railscasts.com/episodes/190-screen-scraping-with-nokogiri
It's explained very well on how to use Nokogiri and scrape content from other sites.

Categories