Twitter Share custom button for wordpress single post

Get Twitter count in PHP

<?php
$twitter_count_data = file_get_contents("http://urls.api.twitter.com/1/urls/count.json?url=".$shareUrl); 
$twitter_count = json_decode($twitter_count_data,true);
?>

HTML Button

<a  href="https://twitter.com/share?url=<?php the_permalink();?>" onclick="javascript:void window.open('https://twitter.com/share?url=<?php the_permalink();?>','1411807436466','width=700,height=500,toolbar=1,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;" class="share_twt_btn" >Share On Twitter</a>
<div class="twitter_count"><?php echo $twitter_count['count'];?></div>

Code for Facebook Share custom button with count in wordpress single post page

PHP code to get the counts

<?php
// code to get FB share count
$shareUrl =  "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$fb_count_data = file_get_contents("https://api.facebook.com/method/links.getStats?urls=".$shareUrl."&format=json");
$fb_count = json_decode($fb_count_data,true);

?>

HTML Button

<a class="share_fb_btn" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink();?>" onclick="javascript:void window.open('https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink();?>','1411807436466','width=700,height=500,toolbar=1,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;">Share On Facebook</a><div class="count"><?php echo $fb_count[0]['total_count'] ; ?></div>