It’s easy to get Facebook information into your NS Basic/App Studio program. Facebook has an API that is easy to access. Send a message to it, and it will return the information you requested.
Here’s how to request information on Mark Zuckerberg:
$.getJSON("https://graph.facebook.com/MarkZuckerberg", "callback=?", gotJSON)
A bit of explanation is in order.
(You could also download the file jquery.min.js into your project’s directory and add it to your manifest.)
The getJSON call has 3 parameters: the URL to get information from, any parameters to send to the URL, and the return function. In this case, we want to get information about Mark Zuckerberg.
When it comes back, we want the function gotJSON to be called on our program. This is an asynchronous operation: your program can continue to run while we wait for graph.facebook.com to reply. When it does, our function is called.
Here is what gotJSON looks like:
If data["error"] Then
txtData.value = data.error.message
txtData.value = ""
For Each index, item in data
txtData.value = txtData.value & index & ": " & item & vbCRLF
The data is returned as a JSON object, which ) is a lightweight text-based open standard designed for human-readable data interchange. What’s left to do is to display the object. Taking advantage of For Each’s ability to iterate both the names and the values of each member of the object, we output one line for each member. Here is the output:
For more information on the Facebook API, see http://developers.facebook.com/docs/reference/api/.