Fetch New Open Graph Image - Facebook - facebook-graph-api

I have the following problem.
I have a social plugin on a particular website, and every day the thumbnail images (Image Open Graph) are changed.
Every day I need to enter the following url:
https://developers.facebook.com/tools/debug/
And insert my url, and click "Fetch new Scrape Information".
To update the facebook Open Graph Image.
Does anyone know how to automate this process?

The Solution:
Facebook - Open Graph not clearing cache
Add to your page:
$.post(
'https://graph.facebook.com',
{
id: '<?php echo $url; ?>',
scrape: true
},
function(response){
console.log(response);
}
);

Related

facebook unsupported post request

I have logged in a user to my app from FB.login now I want to post to the user timeline on the behalf of user. I want to upload a video to the user timeline. I am doing something like:
FB.api(
`/${user_id}/videos`,
"POST",
{
"file_url": video,
"description": description,
"thumb": video_thumbnail,
"title": title,
},
function (response) {
console.log("fb response")
console.log(response)
if (response && !response.error) {
/* handle the result */
console.log("video upload response")
console.log(response)
}
}, {scope: ['user_videos', 'user_actions.video']});
When I do this it is giving me error saying code: 100
fbtrace_id: "F1BDJWtcTXl"
message: "Unsupported post request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
type: "GraphMethodException"
Why I am getting this error ??
Help is appriciated ..
Thank you
Use /me/videos instead of /${user_id}/videos and use single (or double) quotes instead of "`".
Also, you need publish_actions only, and you need to use the scope parameter with FB.login. FB.api is just an API call.
Here´s an example for the login: http://www.devils-heaven.com/facebook-javascript-sdk-login/
And here´s the link to the docs for uploading videos: https://developers.facebook.com/docs/graph-api/reference/user/videos/#Creating
Someone suggested that the App may be in sandbox/dev mode, no sure why this should be a problem but here´s the thread: How to fix "Unsupported post request" when posting to FB fan page?

Android webview shows blank screen after sharing the content on facebook wall ? I am using javascript sdk to share the Post

I am using the javascript sdk to share content on a Facebook wall:
FB.ui({
method:'share',
display: 'touch',
href: 'www.adarshkr.com',
redirect_uri:'www.adarshkr.com'
},
function(response) {
if (response && !response.error)
{
alert("shared");
window.reload();
console.log(response)
}
else
{
FB.init();
}
});
Upon sharing the content its not taking to URL which is specified in redirect_uri. In Android webview, upon sharing the content i am getting the blank screen.. I am not getting response from the facbook.

Facebook post page feed as page admin

var message = 'test';
var picture = 'http://l.yimg.com/f/i/tw/ks/show/120604_mntl01.jpg';
var link = 'https://www.youtube.com/watch?v=BIl8Px1ds3c';
var name = 'great';
var description = 'des';
FB.api('/1437247769881131/feed', 'post', {message: message, picture: picture, name: name, description: description },function (response){
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
I tried posting a test message to my fan page wall , but it become a visitor post(on left)
How could i post to the wall , if i change my admin to fan page admin ,it pop up a dialog
[You're using Facebook as a Page]
[To continue, you'll need to switch from using Facebook as 談政宏 to using Facebook as 談政宏.]
So i change back to person admin , but i can only post a visitor post
How can I post as Page Admin ?
You just need to use a Page Token to post "as Page". Right now you are using a User Token so it will get posted "as User". Information about Access Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

how to use facebook API getting friend's list in javascript

I am not familiar with using Facebook Javascript SDK.
My story is when I access to the website It displays all my friends(pic and name) on a webpage.
I registered Facebook API and App ID
I put website URL as http://localhost:81/ because I am testing my own local machine.
Do you have any good example website or good examples?
Please share with me
Thank you.
First your app should use required permissions like,
user_birthday, friends_birthday, user_location , friends_location...
( for more permissions)
Get info about current user:
FB.api('/me', function(response) {
// Stuff here
});
Get info about current user's friends:
FB.api('/me/friends', function(response) {
// Stuff here
});
you will get the response like,
{data: [{id: "FRIEND1_ID", name: "FRIEND1_NAME"}, {id: "FRIEND2_ID", name: "FRIEND2_NAME"}]....}
If you want get some more properties of your friends, use FIELDS parameter, like
FB.api('/me/friends', {fields: 'name,id,location,birthday'}, function(response) {
// Stuff here
});
If want to get individual user's friend info:
FB.api('/FRIEND1_ID', function(response) {
// Stuff here
});
Try this Example Site
Direct Access Method:
Log into Facebook under your name. If you need an "Access Token", Click on the Extended Permissions and click the "read_friendlist" check box to get your Access Token and then
submit your query. You may need to "Allow" access, so just follow the prompts given.
Voila! You now have the usernames for everyone on your Friends List. The "username" parameter in the query will give you the contact email "message to that person" and you append #facebook.com and send them a message. Very simple.
http://developers.facebook.com/tools/explorer?fql=SELECT%20username%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%29%20ORDER%20BY%20name
-SAB

post big image to facebook wall with facebook javascript api?

How can I post a big image along with my message to my facebook wall?
With the below code it only displays a min image?
And if I post a message and image from inside facebook, then that image is the full width of the timeline, how can I do that with the below code?
function postonwall(){
FB.api('/me/feed', 'post',
{
message : "testtext.",
link : 'http://www.mydomain.se',
picture : 'http://www.mydomain.se/image.jpg',
name : 'somename',
description : 'sometext !'
},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
//alert('Post ID: ' + response.id);
alert('Success: Content Published');
}
});
}
Or what do I have to do to post a big image, if it doesnt work with this?
Any input appreciated, thanks!
From what I've researched, the only way to post large images to a users wall/timeline is through the use of "User Generated Photos in the Open Graph"
Go here to learn more:
https://developers.facebook.com/docs/opengraph/usergeneratedphotos/