How to load aggregated styles / js in an 'external' script via DRUPAL_BOOTSTRAP_FULL? I have an external script / php application that I now have to implement into a running D7 site. So far DRUPAL_BOOTSTRAP_FULL seems to do the job just fine – I can read the session, check the user etc. 

But I am currently stuck trying to load the $styles and $scripts into the head of that external application. I tried drupal_get_css();, also checked the $variables and also tried template_preprocess_html(); to preprocess the  variables –– but D7 won't return anything.

What I have so far:

define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
$base_url = 'http://'.$_SERVER['HTTP_HOST'];
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


I hope somebody can direct me in some direction – any pointers appreciated. Thank you! 

Update: The solution suggested by oksana-c works quite well if you 'only' need to load the top css and js files. The site I'm working on however caches and aggregates all js and css files into one – including various files provided by different modules… So what I would actually need to find out is how to link to those aggregated js and css files. Anybody? 

Update2: I could 'crawl' the folders where the aggregated css and js are stored – however currently I can see 4 different js files and 4 different css files in the head. Also according to the files' timestamps sometimes only 2 files were generated and loaded in the past – so I have basically no indication of how many of the most recent files I should include. Probably some hook would help that would let me list whatever cached/aggregated files are loaded at this time – but I still have no idea where/how to hook into the caching/aggregating functions…
Here's the gist of it (w/ commentary).

&lt;?php
// ... your code 
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// get current theme and it's variables
$current_theme = variable_get('theme_default','none');
$themes = list_themes();
$theme_object = $themes[$current_theme];

// uncomment to display structured information about $theme_object
// var_dump($theme_object);

// get current theme path
$theme_path = dirname($theme_object-&gt;filename);

    // get path of each stylesheet from current theme
  $final_stylesheets = array();
    if (!empty($theme_object-&gt;stylesheets)) {
    foreach ($theme_object-&gt;stylesheets as $media =&gt; $stylesheets) {
      foreach ($stylesheets as $name =&gt; $stylesheet) {
        $final_stylesheets[$media][$name] = $stylesheet;
      }
    }
  }
  foreach ($final_stylesheets as $media =&gt; $stylesheets) {
    foreach ($stylesheets as $stylesheet) {
            // will print relative path to the stylesheet
            // here you can wrap each stylesheet in &lt;link type="text/css" ....&gt; tags
            // and compose the output for hte head section of your script
            print $stylesheet;
    }
  }

    // Do same for scripts
  if (!empty($theme_object-&gt;scripts)) {
    foreach ($theme_object-&gt;scripts as $name =&gt; $script) {
      $final_scripts[$name] = $script;
    }
  }
  foreach ($final_scripts as $script) {
    print $script;
  }
?&gt;


all you have left to do is to wrap each $stylesheet and $script in appropriate tags and insert that into the head.