How to get comments from comments social plugin? - php

I tried with graph api asked many things to there but none of them are returns comments.
I want to get all comments, and put in a separate page for search engines to scan and index.
comments are very rich full and I want them

You can retreive comments (actually posts and their comments) from the Comments plugin from this api url:
https://graph.facebook.com/comments/?ids={$url_of_your_page}

please see the documentation here: http://developers.facebook.com/docs/reference/fql/
the table you need to query is this here:
http://developers.facebook.com/docs/reference/fql/comment/
(it is also one of the first examples)
the key is that you can specify an identifier for every comment plugin that you embed. using this identifier you can then select comments using the graph api.
regarding search engines you should not make the impression that you are serving different content to the spiders than to the users so it would probably be a good idea to load the comments over the api by default (please cache them) and then replace it by the javascript box if javascript is available, so the users can write new comments.
even better (in my opinion) would be always to display the comments in html in your website and only load the facebook comments plugin if the user wants to make a new comment. but that probably requires one additional step for the user.
you can also read about the ajax chrawling scheme

If you want to use the graph API what you do is grab the comment ID in the json (the very first number you see and it appears as {user_id}_{status_message_ID} example: 1234_5678910) and then have https://graph.facebook.com/{the number you got}?access_token={access token}
Do reduce strain what you could do is run the system that you do to put all the status messages and comments onto your website (for instance a 'for each' or 'while' statements etc) then add an 'if' statement that says if count (under comments on the json) is more than 3 it'll retrieve the json for that post using the id and spit out your data.
I hope this was of some help. Please say if you want anything explained further.
Regards,
Jon

You can use this url to get comments of an url and paginate them:
?fields=og_object{comments.order(reverse_chronological).limit(10).after(NgZDZD)}&id={YOUR_URL}
Even It works with latest(v2.10) graph version.

Related

Create a Personalized web search Application based on user profile interests

I am created a personalized search web application .I will create a signup,login and user will fill in his interests based on that i have a doubt in search
I only want to use PHP and JAVA Script alone.
1)After redirecting to that specific search page from login, when i type a specific keyword in that,all i need is ,I need to display results in that domain/web application by fetching the results from search engines.the results should be web content articles,image,video,news.
My doubts is how can i get the feeds from search engine to get displayed in my application such that the keyword which is provoked to search in the search tab should refer to match the user interests which is stored in the database based on this,it should provide the results.
I hope you friends understood the problem statement of this application.
Please help me solve this problem and if any code/book related to this,please tell me.
This isn't a well written question so I'm not entirely sure what you're asking. I interpret the problem as this:
You want a website that registers users with specified interests
You want those users to see tabulated results based on their interests (with the results being lifted from search engines).
The above being a correct interpretation, I would suggest you use something like the "curl" function, mentioned previously on Stackoverflow:
How to get Content ot Remote HTML page
In the above example, the URL specified would (in your case) contain the search engine string. Say you were searching for "bricks in china", then your url string that would be passed to the curl function, would be "https://www.google.co.zw/search?q=bricks+in+china&oq=bricks+in+china"
Another good example of tackling this problem (outside of the Stackoverflow community) is presented here: http://davidwalsh.name/curl-download
Hope that helps :)

How to auto fill Text box in php (Similar to Facebook)

What I am trying to do is to make something similar to what I see all the time on almost any website. The button that says Share to facebook. The goal for me is to let my guests share the item they are viewing in my store (Ran on prestashop) on their blog I run (Running on Oxwall).
The goal is for the button to not only link to a blog post submission webpage but to already have the subject line filled out with the item they are sharing's name and the blog post to display the information about the item. I would like to try and do all this using PHP. I am not sure how to go about doing it but I am sure that I could pass the value. Please note that I can mod BOTH the blog site and the shop as I run both and want to connect them.
As an extra bonus I am also running a forum using phpbb3 if I could do the same thing but onto that as well I would greatly thank you. I am trying to interlink everything into one big network. I know its not an easy task but I am sure there is an easy way to pass data onto the other site so that this can be done.
Facebook a 2 tools to get items informations in the page, it parses the page looking for the most common tags and it uses OpenGraph.
You can also provide product informations in the head of your page (between head tags), then blog side, you retrieve only the contents and parse it as XML.
I advise you to cache this data to avoid useless connections between websites and awful overloads while parsing.
You can use your own specifications, Open Graph or another standard, but i advise to use a standard.

PHP website: Get Disqus comments and comment counts per image id

I'm trying to get the DISQUS comments and comment counts associated with a particular image ID for my PHP site.
1) Get comment count:
To get comment count, I've followed DISQUS' guide, but it just gives me a link to where the comments are on the comic... and not the total number... They say:
Append #disqus_thread to the href attribute in your links. This will tell Disqus which links to look up and return the comment count. For example:
Link.
But how would I get that count if my url string was like this:
Link
So my questions are:
Where would I append #disqus_thread?
How can I get the comments count from that one comic URL and display those total comments on another page?
Why does it just give me a link to the comments and not the comment number for that associated comic?
2) Get specific comments, like most recent or most popular
I haven't really found any documentation on this with the exception of this where they say I'd probably need to write my own script...
Any thoughts?
Thanks!
The comment counting script will basically look up the thread and return the comment counts that match the URL - so it needs to be an absolute URL for that to work.
Assuming you were looking at this document, you'll also notice that there's an optional data-disqus-identifier attribute you can use, and you would use this in conjunction with a disqus_identifier in your commenting embed code. This will override the URL lookup and it will instead pull comment counts for the identifier. You will still need to append the #disqus_thread anchor to your URL, however.
For the second question, you would need to use the API to code a widget to display comments outside of the embed. There's a couple of different approaches you can take:
Load comments directly from the API using either the posts/listPopular or posts/list endpoints (in conjunction with your disqus_identifier)
Load numerous threads details and use the RSS feed of the latest comments using the threads/set endpoint. You can also use this to get the comment counts directly from the API rather than use the comment counting script.

Getting the DISQUS Comments number from dynamic pages and populate MySQL

DISQUS commenting system is nice. API is confusing me a bit, so if anyone can please guide me to the right directions.
What I want to do is to get the total number of comments from dynamic pages/posts and insert that number to a MySQL table so I can filter the posts of those pages according to the total comments number and display each post's comment number in the forontapage, sidebars etc. Of course, I would like to update those rows later with a function I'll create when new comments pop up. But what I am asking is just the way I can get them.
Below my disqus_indentifier:
var disqus_identifier = <?php echo $post_id ?>;
Thanks!
As you discovered, the Disqus comment count script is definitely the best solution for what you're trying to do. It doesn't require any API integration or database work. Simply paste the code on your site and it will automatically find the counts for all comment count links on the page and show the relevant Disqus comment count for each.
For anyone looking to do more granular work along these lines via our API, the best endpoint would probably be threads/details which returns the details for a thread (including the number of comments). As far as inserting that information into your database I'd recommend looking over basic SQL INSERT documentation.
We've also put together some sample API recipes which can help you jumpstart your API integration, including a threads/details PHP script.

getting facebook most shared stuff

I was looking at websites like http://itstrending.com/, facediggs.com/ and I'm questioning myself how do they extract the most shared topics from facebook? I would like to build a similar widget for my blog. I searched the API but couldn't find anything.
I have no idea, but here are more sites that might provide additional insight into what you're looking for: http://mashable.com/2010/08/18/facebook-search-services/
I found this page which is worth looking at
http://developers.facebook.com/blog/post/323
Half way down this page is a url you can use to check pages on your site, it returns xml with some good stats. Hope this helps.
Running an FQL (Facebook Query Language) query on the link_stat table.
Below: example url to put in your browser and press enter.
It returns xml with true and a count which you can use however you like. This returned 957 last time I tried it. Be carefull using quotes around the url you want to query.
How many facebook shares (total) does stackoverflow have?
Another example with 2 urls

Categories