Inherited Variables
Inherited Constants
Inherited Methods
Class Details
Facebook API Wrapper
Tags:
- author - Vincent Gabriel
- version - 2.0
- since - March 16th 2012
[ Top ]
Class Variables
$innerResult = null
[line 25]
Tags:
- var - - inner result from request
- access - protected
Type: mixed
Overrides:
[ Top ]
Class Methods
__construct
void __construct(
array
$config)
[line 38]
Facebook wrapper constructor
You must pass in the appId and secret for this to work properly The configuration:
- appId: the application ID
- secret: the application secret
- fileUpload: (optional) boolean indicating if file uploads are enabled
Tags:
- throws - FBException
- access - public
Parameters:
- array $config - array of settings required to initiate the class successfully
[ Top ]
addAlbum
array|object on addAlbum(
array
$params, [int
$objectId = null])
[line 308]
Add a new photo album to the user profile
Tags:
- return - success it will return an array with an 'id' element with the new album id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/album/
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: name, message
- int $objectId - user profile id that this operation will work on
[ Top ]
addCheckin
array|object on addCheckin(
array
$params, [int
$objectId = null])
[line 366]
Add a new checking to an object
Tags:
- return - success it will return an array with an 'id' element with the new checkin id on failure it will return an FacebookApiException object with the error message in it
- link - - each object has a comments section that you can see if it allows comments
- permission - publish_stream, user_checkins
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: coordinates, place, message, tags
- int $objectId - user profile id or object id that this operation will work on
[ Top ]
addComment
array|object on addComment(
array
$params, int
$objectId)
[line 352]
Add a new comment to an object
Tags:
- return - success it will return an array with an 'id' element with the new comment post id on failure it will return an FacebookApiException object with the error message in it
- link - - each object has a comments section that you can see if it allows comments
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: message
- int $objectId - user profile id or object id that this operation will work on
[ Top ]
addEvent
array|object on addEvent(
array
$params, [int
$objectId = null])
[line 294]
Add a new event
Tags:
- return - success it will return an array with an 'id' element with the new event id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/event/
- permission - create_event
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: name, start_time, end_time
- int $objectId - user profile id that this operation will work on
[ Top ]
addLink
array|object on addLink(
array
$params, [int
$objectId = null])
[line 280]
Add a new link to the user profile
Tags:
- return - success it will return an array with an 'id' element with the new link id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/link/
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: link, message, picture, name, caption, description
- int $objectId - user profile id that this operation will work on
[ Top ]
addNote
array|object on addNote(
array
$params, [int
$objectId = null])
[line 338]
Add a new note
Tags:
- return - success it will return an array with an 'id' element with the new note id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/note/
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: message, subject
- int $objectId - user profile id that this operation will work on
[ Top ]
addPhoto
array|object on addPhoto(
array
$params, int
$objectId)
[line 322]
Add a new photo to an album
Tags:
- return - success it will return an array with an 'id' element with the new photo id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/photo/
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: message, source, place (multipart/form-data)
- int $objectId - album id that this operation will work on
[ Top ]
addWallPost
array|object on addWallPost(
array
$params, [int
$objectId = null])
[line 266]
Add a new wall post to the objectId's wall
Tags:
- return - success it will return an array with an 'id' element with the new wall post id on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/post/
- permission - publish_stream
- access - public
Parameters:
- array $params - list of key=>value pairs that represent the post data: message, picture, link, name, caption, description, source, place, tags
- int $objectId - user profile id that this operation will work on
[ Top ]
clear
void clear(
)
[line 508]
Clear all states from the persistent storage
Tags:
- access - public
Parameters:
[ Top ]
clearState
void clearState(
string
$key)
[line 500]
Clear a certain state from the persistent storage
Tags:
- access - public
Parameters:
- string $key - the key we would like to clear
[ Top ]
eventAttending
array|object on eventAttending(
int
$objectId)
[line 390]
attend an event
Tags:
- return - success it will return boolean value on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/event
- permission - publish_stream, user_events
- access - public
Parameters:
- int $objectId - object id that you want to like
[ Top ]
eventDeclin
array|object on eventDeclin(
int
$objectId)
[line 414]
decline attending an event
Tags:
- return - success it will return boolean value on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/event
- permission - publish_stream, user_events
- access - public
Parameters:
- int $objectId - object id that you want to like
[ Top ]
eventMaybe
array|object on eventMaybe(
int
$objectId)
[line 402]
maybe attend an event
Tags:
- return - success it will return boolean value on failure it will return an FacebookApiException object with the error message in it
- link - https://developers.facebook.com/docs/reference/api/event
- permission - publish_stream, user_events
- access - public
Parameters:
- int $objectId - object id that you want to like
[ Top ]
getAlbums
array getAlbums(
[string|int
$objectId = null])
[line 186]
Return array of albums
Tags:
- permission - user_photos
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getBooks
array getBooks(
[string|int
$objectId = null])
[line 146]
Return array of books
Tags:
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getCheckins
array getCheckins(
[string|int
$objectId = null])
[line 226]
Return array of checkins
Tags:
- permission - user_checkins
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getError
array getError(
)
[line 430]
Return the error array with the error message, code, type etc..
Tags:
- access - public
Parameters:
[ Top ]
getErrorCode
int|string getErrorCode(
)
[line 438]
Return the error code from the last operation
Tags:
- access - public
Parameters:
[ Top ]
getErrorMessage
string getErrorMessage(
)
[line 447]
Return the error message from the last operation
Tags:
- access - public
Parameters:
[ Top ]
getEvents
array getEvents(
[string|int
$objectId = null])
[line 206]
Return array of events
Tags:
- permission - user_events
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getFeed
array getFeed(
[string|int
$objectId = null])
[line 106]
Return array of news feed items
Tags:
- permission - read_stream
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getFriends
array getFriends(
[string|int
$objectId = null])
[line 96]
Return array of friends
Tags:
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getGroups
array getGroups(
[string|int
$objectId = null])
[line 216]
Return array of groups
Tags:
- permission - user_groups
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getId
mixed|array|string getId(
)
[line 473]
Return the id of the last operation
when a push operation is performed and is successful the id will be returned
Tags:
- access - public
Parameters:
[ Top ]
getLikes
array getLikes(
[string|int
$objectId = null])
[line 116]
Return array of likes that the user liked
Tags:
- permission - user_likes
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getLocations
array getLocations(
[string|int
$objectId = null])
[line 236]
Return array of locations
Tags:
- permission - user_locations
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getMovies
array getMovies(
[string|int
$objectId = null])
[line 126]
Return array of movies
Tags:
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getMusic
array getMusic(
[string|int
$objectId = null])
[line 136]
Return array of music
Tags:
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getNotes
array getNotes(
[string|int
$objectId = null])
[line 156]
Return array of notes
Tags:
- permission - user_notes
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getObjectId
string|int getObjectId(
[string|int
$objectId = null])
[line 554]
Return the objectid if the parameter is not null, if it is return the current logged in user
Tags:
- access - protected
Parameters:
- string|int $objectId - optional the object id to perform the operation on
[ Top ]
getObjectInfo
array getObjectInfo(
string|int
$objectId)
[line 66]
Return an object info, can be a user profile, page, group etc..
All objects in Facebook can be accessed in the same way:
Users: https://graph.facebook.com/btaylor (Bret Taylor) Pages: https://graph.facebook.com/cocacola (Coca-Cola page) Events: https://graph.facebook.com/251906384206 (Facebook Developer Garage Austin) Groups: https://graph.facebook.com/195466193802264 (Facebook Developers group) Applications: https://graph.facebook.com/2439131959 (the Graffiti app) Status messages: https://graph.facebook.com/367501354973 (A status message from Bret) Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola page) Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola's wall photos) Profile pictures: https://graph.facebook.com/vincent.v.gabriel/picture (your profile picture) Videos: https://graph.facebook.com/817129783203 (A Facebook tech talk on Graph API) Notes: https://graph.facebook.com/122788341354 (Note announcing Facebook for iPhone 3.0) Checkins: https://graph.facebook.com/414866888308 (Check-in at a pizzeria)
Tags:
- return - returns an array with public information
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getObjectPicture
string getObjectPicture(
[string|int
$objectId = null])
[line 86]
Return the object profile picture
Tags:
- return - public image location
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getPermissions
array getPermissions(
[string|int
$objectId = null])
[line 166]
Return array of permissions
Tags:
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getPhotos
array getPhotos(
[string|int
$objectId = null])
[line 176]
Return array of photos
Tags:
- permission - user_photos
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getResult
array getResult(
)
[line 464]
Return the result from the last operation
Tags:
- access - public
Parameters:
[ Top ]
getUserInfo
array getUserInfo(
[string|int
$objectId = null])
[line 76]
Return the user info
Tags:
- return - returns an array with public information
- permission - none
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
getVideos
array getVideos(
[string|int
$objectId = null])
[line 196]
Return array of videos
Tags:
- permission - user_videos
- access - public
Parameters:
- string|int $objectId - the object id can be the id or the name
[ Top ]
isError
boolean isError(
)
[line 422]
Check to see if there was an error in the last operation
Tags:
- access - public
Parameters:
[ Top ]
isSuccess
boolean isSuccess(
)
[line 456]
Check to see if the last operation was successful
Tags:
- access - public
Parameters:
[ Top ]
like
array|object on like(
int
$objectId)
[line 378]
Like an object
Tags:
- return - success it will return boolean value on failure it will return an FacebookApiException object with the error message in it
- link - - each object has a likes section that you can see if it allows likes
- permission - publish_stream
- access - public
Parameters:
- int $objectId - object id that you want to like
[ Top ]
search
array search(
string
$query, [string
$type = null])
[line 248]
Return array of search results
Tags:
- link - - see searching section
- permission - none
- access - public
Parameters:
- string $query - the search term you are searching for
- string $type - the type of object you are looking for for example: user, application, post, page, event, group etc...
[ Top ]
_apiCall
object|array _apiCall(
string
$apiKey, array
$params, [string|int
$objectId = null])
[line 519]
Perform a push api call
Tags:
- access - protected
Parameters:
- string $apiKey - the actual api key
- array $params - array of data to send to the api
- string|int $objectId - optional the object id to perform the operation on
[ Top ]
_apiGet
object|array _apiGet(
[string
$key = null], [string|int
$objectId = null])
[line 536]
Perform a get api call
Tags:
- access - protected
Parameters:
- string $key - the actual api key
- string|int $objectId - optional the object id to perform the operation on
[ Top ]