Note that there are some explanatory texts on larger screens.

plurals
  1. POClear Facebook share cache with cURL and lint
    text
    copied!<p>I have the problem with shareing facebook content on my website. It's implemented the 'Like' button but when you 'like' the picture on your facebook profile is shown old picture (obiously cached picture). The things on that website works like this... every day there is a new picture of a girl of the day, but the url is always the same (rewritten by apache).</p> <p>I must find some way to automatically and periodically (when new picture is set on site) clear facebook cache.</p> <p>When I put url for which I want to refresh cache directly in the fb debug tool (lint) form and press 'debug' it clears cache and refresh content when somobody likes content on my website.</p> <p>But the problem is when I try refresh cache automaticaly (through php script or via cron job). Something like this not working:</p> <pre><code>wget http://developers.facebook.com/tools/debug/og/object?q=http://www.vecernji.hr/djevojka-dana </code></pre> <p>or like this also don't working:</p> <pre><code>curl http://developers.facebook.com/tools/debug/og/object?q=http://www.vecernji.hr/djevojka-dana </code></pre> <p>Also, the php script not working:</p> <pre><code>$url = "http://developers.facebook.com/tools/debug/og/object?q=http://www.vecernji.hr/djevojka-dana"; $useragent = "Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.10.229 Version/11.60"; if ( $ch = curl_init( $url ) ) { curl_setopt( $ch , CURLOPT_HEADER , 0 ); curl_setopt( $ch , CURLOPT_RETURNTRANSFER , true ); curl_setopt( $ch , CURLOPT_USERAGENT , $useragent ); $str_response = curl_exec( $ch ); if( curl_errno( $ch ) != 0 ) { $message = 'Girl of the day - cURL exec error: ' . $ch; error_log( $message ); } curl_close( $ch ); } else { $message = 'Girl of the day - cURL init with url: ' . $url . ' failed'; error_log( $message ); } </code></pre> <p>The content to like is on urls:</p> <p><a href="http://www.vecernji.hr/djevojka-dana" rel="nofollow">http://www.vecernji.hr/djevojka-dana</a> and <a href="http://www.vecernji.hr/decko-dana" rel="nofollow">http://www.vecernji.hr/decko-dana</a></p> <p>Does anyone know the reason why I can't refresh cache via php script, wget or curl, but when I put given url directly and manually in the lint form and press submit button the the content refreshes?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload