parse facebook page query - php

I was wondering if someone knew a way of parsing the results of a query done through the search bar in Facebook. I don't manage to get around that "see more reults" button at the end, and I would like to find a way of getting all the results of the search.
I guess a DOM parser is not the solution, since it will only scan the results available on the page:
DOM to parse Facebook wall
Thank you in advance!
Guillermo

The problem is, all the results that show after "see more results" is clicked is loaded dynamically via AJAX. Your goal, then, will be to replicate that functionality by manually calling the URL that Facebook calls and getting the results from that (provided that Facebook doesn't use unique tokens to validate the loading of more results in the URL).
I would suggest that you see if you can find the URL that Facebook uses to load more search results.

Related

How to extract Google Search results redirect URLs using PHP

I need a way for PHP to extract the FIRST result's URL from google search results page but I need the Redirect URL.
The search query:
https://www.google.com/search?site=&source=hp&q=what%27s+new+in+windows+phone
I need this link:
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CC0QFjAA&url=http%3A%2F%2Fwww.windowsphone.com%2Fen-us%2Fhow-to%2Fwp8%2Fbasics%2Fwhats-new-in-windows-phone&ei=KL03VeH-Icvfavz-gcAD&usg=AFQjCNEYZMSiSVQ-TKnKgbNNT5CY1o_1kw`
Not the actual link:
http://www.windowsphone.com/en-us/how-to/wp8/basics/whats-new-in-windows-phone
Can anyone suggest anything? I would think you need to use Curl to fetch the page and then use Dom to parse the HTML to give you the redirect url. Just don't know how to do this exactly. Any help would be appreciated.
I have researched quite a bit but have only found questions on how to get the normal URL.

Get the complete html code from an album of facebook

I'm trying to get the html code from an album of facebook,once done that i want to extract the photo links,
but as we know all the photos are not loaded at once but as you scroll down.
When i use cURL it get only those links of the photos which are loaded at first.
Will there be a way to get the whole loaded html code through php?
Please bear with my english.
Thanks
EDIT: Well i was wanting to do the same on any page which have this kind of behavior not only on facebook. Thanks anyway
You will not be able to reliably fetch an album from Facebook via this method.
There are a small amount of photos sent with the original request and the rest are loaded via ajax. Using curl, there is no way that I am aware of to simulate the events that lead to said ajax load. You could call the original, and then subsequently call the other ajax endpoints but this method is likely to break the second fb changes anything.
As ceejayoz said, you should be using the fb api for this sort of thing.

AddThis - Posting a variable score to Facebook and Twitter

Is it possible to have facebook and twitter "AddThis" links pull a user's score from a game?
Im developing a simple HTML5 "quiz". There is a score counter set up that I would like to be able to echo to the Twitter and Facebook share options, but I cant seem to make this work and im not sure if it's even possible...
The counter is handled through JS and displays dynamically in "#score":
<div id="score-counter"><span id="score"></span<span>/20</span></div>
I would like to be able to share something like "I got '__'/20 on this game, can you beat me?"
Looked through a ton of documentation but still can't seem to figure it out... Can anyone advise how to go about accomplishing this?
Since the open graph is essentially a page scraper, you can't dynamically generate meta tags via javascript. Essentially, this answer is probably the right one which will ultimately lead you to this question/answer.
You would basically need to create a separate share url where you'd pass in query parameters for the page to read in order to dynamically spit out the correct meta tags for the open graph to see.

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

How to fetch custom Google Search results by simple html dom parser?

I have a custom Google Search included on a html page. like
http://www.******.com/search.htm?cx=partner-pub--00000000000-c77&cof=FORID%3A10&ie=ISO-8ds3-1&q=software&sa=Search&siteurl=www.******.com%2#1342
When I am using same url in browser I get results. I want to call it by simple dom html parser then it is returning blank.
Or how can I fetch Google custom search results with Google partner ID via Simple HTML DOM parser so I can get analytics for searches done.
You can't, they have safeguards against that and it is against their terms of use.
Excerpt from the Web Search API Terms of Service:
[...]By way of example, and not as a limitation, You agree that when using the Service, You will not, and will not permit users or other third parties to:
[...] use any robot, spider, site search/retrieval application, or other device to retrieve or index any portion of Google Search Results or to collect information about users for any unauthorized purpose;
I do not know about the custom google search, but with the normal one I got all results, by simply applying the
url[?]q=([^&]+)&
regex to all hrefs.
edit: taking the match in the parentheses to get the url, ofc.
(Did not notice that this was an old question that was edited (for what?), but perhaps it is still useful for someone)

Categories