Facebook 如何清除共享链接缓存?
我尝试共享一个链接,例如在我的个人资料页面的“更新状态”下。在我修改了应用程序的内容之后,它仍然显示缓存。我尝试使用清除缓存,但结果仍然相同。任何帮助都将不胜感激。Facebook 如何清除共享链接缓存?,facebook,hyperlink,share,Facebook,Hyperlink,Share,我尝试共享一个链接,例如在我的个人资料页面的“更新状态”下。在我修改了应用程序的内容之后,它仍然显示缓存。我尝试使用清除缓存,但结果仍然相同。任何帮助都将不胜感激。 等等 再次尝试删除该url或告诉任何人为您执行此操作(可能会产生imedate效果) 等等 等等 再次尝试删除该url或告诉任何人为您执行此操作(可能会产生imedate效果) 等等 试试这个: $fbURL = 'https://developers.facebook.com/tools/debug/og/object?q=';
- 等等李>
- 再次尝试删除该url或告诉任何人为您执行此操作(可能会产生imedate效果)
- 等等
- 等等李>
- 再次尝试删除该url或告诉任何人为您执行此操作(可能会产生imedate效果)
- 等等
$fbURL = 'https://developers.facebook.com/tools/debug/og/object?q=';
$shareURL = '<YOUR URL>';
$excuteURL = $fbURL.urlencode($shareURL)."&format=json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $excuteURL);
//curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
$data = curl_exec($ch);
curl_close($ch);
$fbURL='1!'https://developers.facebook.com/tools/debug/og/object?q=';
$shareURL='';
$excuteURL=$fbURL.urlencode($shareURL)。“&format=json”;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$excuteURL);
//curl_setopt($ch,CURLOPT_头,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0(Windows;U;windowsnt 6.1;en-US;rv:1.9.1.2)Gecko/20090729 Firefox/3.5.2 GTB5');
$data=curl\u exec($ch);
卷曲关闭($ch);
请注意,您需要传递用户代理,因为这是Facebook服务器解析请求所必需的。尝试以下操作:
$fbURL = 'https://developers.facebook.com/tools/debug/og/object?q=';
$shareURL = '<YOUR URL>';
$excuteURL = $fbURL.urlencode($shareURL)."&format=json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $excuteURL);
//curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
$data = curl_exec($ch);
curl_close($ch);
$fbURL='1!'https://developers.facebook.com/tools/debug/og/object?q=';
$shareURL='';
$excuteURL=$fbURL.urlencode($shareURL)。“&format=json”;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$excuteURL);
//curl_setopt($ch,CURLOPT_头,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0(Windows;U;windowsnt 6.1;en-US;rv:1.9.1.2)Gecko/20090729 Firefox/3.5.2 GTB5');
$data=curl\u exec($ch);
卷曲关闭($ch);
请注意,您需要传递用户代理,因为这是Facebook服务器解析请求所必需的。您可以直接使用。只需将URL粘贴到其中,然后点击调试
您可以告诉facebook在发送请求中使用“scrape=true”post参数重新抓取内容。有关详细信息,请参见。您可以直接使用。只需将URL粘贴到其中,然后点击调试
您可以告诉facebook在发送请求中使用“scrape=true”post参数重新抓取内容。更多详细信息请参见。我遇到了这个问题,但这是一个特定的帖子,而不是整个网站。在更新我的博客帖子后,我在调试器中获取缓存以显示正确的图片,但当我以状态发布链接时,Facebook仍然显示一张旧图片。我不想等一天看它是否会最终改变,所以我做了本页概述的事情: 换句话说,类似这样的事情:
<b:if cond='data:blog.url == "http://urlofyourpost.com"'>
<meta content='http://urlofyourimage.png' property='og:image'/>
</b:if>
基本上,您将把if语句硬编码到页面的HTML中,以使其更改该帖子的元内容。这是一个混乱的解决方案,但它是有效的 我有这个问题,但它是一个特定的帖子,而不是整个网站。在更新我的博客帖子后,我在调试器中获取缓存以显示正确的图片,但当我以状态发布链接时,Facebook仍然显示一张旧图片。我不想等一天看它是否会最终改变,所以我做了本页概述的事情: 换句话说,类似这样的事情:
<b:if cond='data:blog.url == "http://urlofyourpost.com"'>
<meta content='http://urlofyourimage.png' property='og:image'/>
</b:if>
基本上,您将把if语句硬编码到页面的HTML中,以使其更改该帖子的元内容。这是一个混乱的解决方案,但它是有效的 上述方法对我不起作用。但是,我使用javascript清除缓存并在facebook上获取最新内容
if(window.location.search.indexOf("facebook_refresh") >= 0) {
//Feature check browsers for support
if(document.addEventListener && window.XMLHttpRequest && document.querySelector) {
//DOM is ready
document.addEventListener("DOMContentLoaded", function() {
var httpRequest = new XMLHttpRequest();
httpRequest.open("POST", "https://graph.facebook.com", true);
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4) {
console.log("httpRequest.responseText", httpRequest.responseText);
}
};
//Default URL to send to Facebook
var url = window.location;
//og:url element
var og_url = document.querySelector("meta[property='og:url']");
//Check if og:url element is present on page
if(og_url != null) {
//Get the content attribute value of og:url
var og_url_value = og_url.getAttribute("content");
//If og:url content attribute isn't empty
if(og_url_value != "") {
url = og_url_value;
} else {
console.warn('<meta property="og:url" content=""> is empty. Falling back to window.location');
}
} else {
console.warn('<meta property="og:url" content=""> is missing. Falling back to window.location');
}
//Send AJAX
httpRequest.send("scrape=true&id=" + encodeURIComponent(url));
});
} else {
console.warn("Your browser doesn't support one of the following: document.addEventListener && window.XMLHttpRequest && document.querySelector");
}
}
if(window.location.search.indexOf(“facebook_刷新”)>=0){
//功能检查浏览器以获得支持
if(document.addEventListener&&window.XMLHttpRequest&&document.querySelector){
//多姆准备好了
document.addEventListener(“DOMContentLoaded”,function()){
var httpRequest=new XMLHttpRequest();
httpRequest.open(“POST”https://graph.facebook.com“,对);
httpRequest.onreadystatechange=函数(){
如果(httpRequest.readyState==4){
log(“httpRequest.responseText”,httpRequest.responseText);
}
};
//发送到Facebook的默认URL
var url=window.location;
//og:url元素
var og_url=document.querySelector(“meta[property='og:url']);
//检查页面上是否存在og:url元素
如果(og_url!=null){
//获取og:url的内容属性值
var og_url_value=og_url.getAttribute(“内容”);
//如果og:url内容属性不为空
如果(og_url_值!=“”){
url=og_url_值;
}否则{
console.warn('is empty.Falling back to window.location');
}
}否则{
console.warn('is missing.Falling back to window.location');
}
//发送AJAX
httpRequest.send(“scrape=true&id=“+encodeURIComponent(url));
});
}否则{
console.warn(“您的浏览器不支持以下任一项:document.addEventListener&&window.XMLHttpRequest&&document.querySelector”);
}
}
上述方法对我不起作用。但是,我使用javascript清除缓存并在facebook上获取最新内容
if(window.location.search.indexOf("facebook_refresh") >= 0) {
//Feature check browsers for support
if(document.addEventListener && window.XMLHttpRequest && document.querySelector) {
//DOM is ready
document.addEventListener("DOMContentLoaded", function() {
var httpRequest = new XMLHttpRequest();
httpRequest.open("POST", "https://graph.facebook.com", true);
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4) {
console.log("httpRequest.responseText", httpRequest.responseText);
}
};
//Default URL to send to Facebook
var url = window.location;
//og:url element
var og_url = document.querySelector("meta[property='og:url']");
//Check if og:url element is present on page
if(og_url != null) {
//Get the content attribute value of og:url
var og_url_value = og_url.getAttribute("content");
//If og:url content attribute isn't empty
if(og_url_value != "") {
url = og_url_value;
} else {
console.warn('<meta property="og:url" content=""> is empty. Falling back to window.location');
}
} else {
console.warn('<meta property="og:url" content=""> is missing. Falling back to window.location');
}
//Send AJAX
httpRequest.send("scrape=true&id=" + encodeURIComponent(url));
});
} else {
console.warn("Your browser doesn't support one of the following: document.addEventListener && window.XMLHttpRequest && document.querySelector");
}
}
if(window.location.search.indexOf(“facebook_刷新”)>=0){
//功能检查浏览器以获得支持
if(document.addEventListener&&window.XMLHttpRequest&&document.querySelector){
//多姆准备好了
document.addEventListener(“DOMContentLoaded”,function()){
var httpRequest=new XMLHttpRequest();
httpRequest.open(“POST”https://graph.facebook.com“,对);
httpRequest.onreadystatechange=函数(){
如果(ht