Facebook – fbml_refreshImgSrc
October 18, 2007 @ 2:08 pm in Open Source, PHP
Maybe its just a temporary thing, but lately the Facebook server has had major issues with caching images. If you are unaware, all images that are placed within a users profile page get scraped by Facebook and served up from their own internal servers. If for some unforeseen reason there scraper fails your image gets replaced with an invisible pixel spacer gif. To force the cache to update you have to manually call the fbml_refreshImgSrc method on their REST server. The easiest way to accomplish this is to create a dedicated page that uses an infinite session. Here is the PHP page I created to update the images as necessary.
1 2 3 4 5 6 | $myClass = new my_class($api_key, $secret); //this sets a user and session $myClass ->facebook->set_user($global_user, $global_session); if(isset($_GET['url'])) { echo '' . $myClass ->facebook->api_client->fbml_refreshImgSrc($_GET['url']) .''; } |
/p>
Tagged as 

January 27th, 2008 at 7:48 am
Hey,
I’m trying to get this to work but I’m a bit of a beginner here. Could you walk me through the process?
Thanks.
January 27th, 2008 at 8:01 am
I’m getting a
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or ‘$’ in /home/facebook_app/update.php on line 2
any ideas?
March 10th, 2009 at 9:10 am
If you are getting an error it is most likely because you are not calling the Facebook Client. Example:
$facebook = new Facebook($api_key, $secret);
Hope this helps.