launching parser script once in 24 hours I have a file parser.php

$url = 'http://site.kz';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0 ");
curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 );
$link = curl_exec($ch);
curl_close($ch);


so all contents of the site -site.kz is in $content variable. If i call this script http://site.kz/sites/all/themes/mytheme/parser.php -> it starts to grab this page, right?

How can i make available that variable $link in a page.tpl.php? If i make include ('parser.php') then everytime i F5 my page → parser is going to work (creates load to the server).
If you don't want your script to execute on each page load, you have to set up a cron job, either via hook_cron() or a separate job.

To make a variable available in a template file, you have to use a preprocess function of some sort.

With these two elements, you should be able to make your script work and be integrated with Drupal.