This might be a problem of how the URL is being formatted. If the options
argument is not specified, the resulting URL would look like: /me/photos&access_token=...
. Here, the path
would be /me/photos&access_token
which probably is not a valid URL component as per Facebook API.
I think the following changes to the facebook
function would fix this:
require(RCurl)
require(rjson)
facebook <- function( path = "me", access_token = token, options){
if( !missing(options) ){
options <- sprintf(
"?%s&",
paste(
names(options), "=", unlist(options),
collapse = "&", sep = ""
)
)
} else {
options <- "?"
}
urlTemplate <- "https://graph.facebook.com/%s%saccess_token=%s"
data <- getURL(
sprintf(
urlTemplate,
path,
options,
access_token
)
)
fromJSON( data )
}
Now, even if the options
argument is missing, the resulting URL would look like: /me/photos?access_token=...
.