Custom column working problem

I am adding a column to manage number of post shares on twitter. I made this code:

function Twits($url) {
$s = file_get_contents("http://urls.api.twitter.com/1/urls/count.json"."?callback=?&url=".urlencode($url));             //line 1218
preg_match("#("count"):([0-9]*)#",$s,$ar);
return isset($ar[2]) ? $ar[2] : 0;  }

add_filter('manage_posts_columns', 'columns_head');
add_filter('manage_posts_custom_column', 'columns_content', 10, 2);

function columns_head($defaults) { 
    $defaults['twitter_shares'] = 'Twitter Shares'; 
    return $defaults; 
}

function columns_content($column_name, $post_ID) {
if ($column_name == 'twitter_shares') {
echo Twits(get_permalink($post->ID)); }     
}

It works fine on localhost, but shows errors and warnings on main site, here are those:

Read More
Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/content/61/10208161/html/.../functions.php on line 1218

Warning: file_get_contents(http://urls.api.twitter.com/1/urls/count.json?callback=?&url=http%3A%2F%2abc123.com%2F2013%2F04%2F02%2Fchanged-into%2F) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/content/61/10208161/html/.../functions.php on line 1218
0

line 1218 is in above code.

Related posts

Leave a Reply