FB-> api抛出异常

I am trying to post messages on my facebook page automatically from my website using php. The problem i am facing is that when i run the php script from localhost using WAMPSERVER the script works fine. But when i upload it on webserver it throws the following exception

/couldn't connect to host

Please help me.

    /<?php
    // Path to PHP-SDK

    require_once("php-sdk/facebook.php"); // set the right path

    $config = array();
    $config['appId'] = 'xxxxxxxxxx';
    $config['secret'] = 'xxxxxxxxx';
    $config['fileUpload'] = false; // optional
    $fb = new Facebook($config);

    $params = array(
    // this is the main access token (facebook profile)
    "access_token" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "message" => "Here is a blog post about auto posting on Facebook without being 
     signed in using PHP #php #facebook",
    "link" => "http://www.pontikis.net/blog/auto_post_on_facebook_with_php",
    "picture" => "http://i.imgur.com/lHkOsiH.png",
    "name" => "How to Auto Post on Facebook with PHP",
    "caption" => "www.pontikis.net",
    "description" => "Automatically post on Facebook with PHP using Facebook PHP SDK.  
      How to create a Facebook app. Obtain and extend Facebook access tokens. Cron 
      automation."
     );

    try {
         $ret = $fb->api('/me/feed', 'POST', $params);
         echo 'Successfully posted to Facebook Personal Profile';
    } catch(Exception $e) {
         echo $e->getMessage();
         echo 'not published';
    }

   ?>