if (empty($data['oauth_token']) || empty($data['oauth_token_secret'])) {
    throw new HTTP_OAuth_Consumer_Exception_InvalidResponse(
       'Failed getting token and token secret from response', $response
    );
}

print_r($data);

$consumer->setToken($data['oauth_token']);
$consumer->setTokenSecret($data['oauth_token_secret']);


// 5. Save credentials to config file
$handle = @fopen("visualplatform.config.php", "w");
$_conf = array(
                'domain'       => $data['domain'],
                'user_id'      => $data['user_id'],
                'key'          => $consumer->getKey(),
                'secret'       => $consumer->getSecret(),
                'token'        => $consumer->getToken(),
                'token_secret' => $consumer->getTokenSecret()
        );
fwrite($handle, '<? $visualplatform_config = unserialize(\'' . serialize($_conf) . '\'); ?>');
fclose($handle);



?>