Facebook search - php

I am new to facebook api. I want to search for a particular word on facebook. I have gone through the documentation at https://developers.facebook.com/docs/reference/api/. But I dont know how to construct the query in PHP.
Could any one please provide a sample code. Also how do I specify the count and page (like twitter)?
I am currently using the API provided by facebook. I saw that there are alternative API's but I would like to restrict the API to the official one

Facebook provides the search functionality which is like searching using the search inside facebook.com.
To read about it go to here: http://developers.facebook.com/docs/reference/api/#searching
Edit
As it states in that document:
When searching for public posts or posts on the user's News Feed, you
can page over the results by using the since, until and limit
parameters. since and until both accept a unix timestamp.
Also, just a bit above the "searching" section there's the "Paging" section, using both you can come up with:
https://graph.facebook.com/search?q=coffee&type=place&offset=X&limit=4
Which in terms of using the php sdk, is probably like: "search?q=coffee&type=place&offset=X&limit=4"

Related

How to parse Wikihow with this API?

I want to be able to parse the website wikihow.com, so after some reasearch I find this page. But despites my reading I don't know who to parse the website.
For example, when I make a search on the website, I have a list of links with images to choose which I want to read.
So I try to do the same with the api. I try to use the query option like this : http://www.wikihow.com/api.php?action=query&titles=fries. Nothing came. Is it really an API for the website. Do you have an example of how to use the api.
Yes, wikiHow's API is the same as MediaWiki's API..But it does not provide API like http://www.wikihow.com/api.php?action=query&titles=fries

How do I search for users in Facebook using certain conditions such as location in Graph API

I've been experimenting with the Facebook Graph API, and been researching several questions on Stack Overflow and other internet resources, and I can't seem to figure out how to search users in Graph API and see their location as well (assuming their location is publicly available).
I've looked at:
Facebook Search API - List all users based on location?
PHP Facebook FQL: Making queries in the new SDK
Search for posts using Facebook Graph Api
And although one of them says that you can search for users based on location, I don't think that's correct. But, I was under the impression FQL is no longer supported, as it has been replaced by the Graph API?
Currently I formulate a Graph API URL like the following:
https://graph.facebook.com/search?q=Users_to_Search&type=user&center=47.5700,122.6525&distance=10000&access_token=ACCESS_TOKEN
To try and find users near a certain point, but apparently the "center" and "distance" arguments are simply ignored, and the page merely lists all users that match the query, and only lists their name and ID, not location.
Is there any way to search for users, but only if they're in a certain location? Something like:
SELECT users FROM user WHERE Location="Bremerton, Washington"
Simply put: This is not possible via search afaik. Have a look at the Search API docs here: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#search
Also with FQL (which will be available until April 30th 2016), there's no way of doing this.

Facebook search public photos by hashtag

I work with Facebook API SDK. I'm trying to get all public photos using https://graph.facebook.com/search?access_token=xxxx|xxxxx&q=%23hashtag&type=post
But I have a problem: result contains only shared photos in first account. When i'm posting photo without share, search not found it.
Otherwise, I have another account where I'm posted photo and share it, but photo is not found too.
Who knows, how can I get all public photos with hastag using FQL or graph search
Addition:
Few days ago - facebook search is not working
After discussing with facebook developers, I got the answer:
Facebook API does not support searching for hashtags.
%23 is just the URL encoded version of a # which gets decoded on a
server generally so it still won't work. For example if I wanted to
search for #YOLO I would just say q=YOLO with no # or it's URL encoded
form.
It's just something that the api doesn't support at the moment
Facebook has officially deprecated the post search type. Im not sure when exactly but I can tell you I tried today (10/15/2014) and its a no go.

Integration with google search result

I want to build a system in which the user enters a website domain and a word, and the system shows in which place he is located.
How can I get the search result from Google? there is any way? I am working with PHP and JavaScript.
Google does not provide a public API for querying the ranking (PageRank) of a page.
You could perform the query yourself and check the results against the domain you're looking for, but unless you look only to the first pages, it becomes unfeasible.
As to how to perform Google searches programmatically, see the Custom Search API.

Google Custom Search Engine (CSE) API

I am trying to integrate a site search feature into a client's site. I've created an test search engine with Google Custom Search, but I can't sort out how to make it work with the following criteria:
The search form posts back to the site
The POST page uses an API to get the result back from Google
I display the results within my site
Am I misunderstanding how Google Custom Search works? Is there a simple tutorial somewhere that fits my criteria?
Thanks!
Google Custom Search Business Edition specifically has the API to return XML results, with which you can do what you please. Business Edition is not free.
Here is the XML results documentation.
From PHP, you can use cURL to pass your POSTed search query on to Google CSE as a GET request, and then do whatever you want with the XML server side or client side.
Check out http://www.google.com/cse/docs/resultsxml.html
But basically yeah: have a page on your site that when it gets a post/get variable it makes an http request to Google containing (at least) your search term and your api key, it then receives a load of XML in return which it then formats and returns on the page.
It's pretty straightforward. I've not implemented it in PHP, which judging by your tag is the lanaguage you're looking to do it in, but something like http://www.seopher.com/articles/google_custom_search_tutorial_using_xml_and_php_ should put you on the right track.

Categories