Hmmm...
I do tend to be brief with very abstract questions that beg an entire script to be written as an example.
here's some tips though:
format your text file like an ini file.
[domain1.com]
count_in=12
count_out=31
[domain2.com]
count_in=29
count_out=14
you'll use the parse_ini('filename') function to actually parse it.
<?
$log = parse_ini_file($iniFile_path, TRUE);
//output the resulting array...
print_r($ini);
/
for each $HTTP_REFERER you tracked,
you'd put that as an array...
/
$referer = parse_url($GLOBALS['HTTP_REFERER']);
$log[$referer['host']]['count_in']++;
foreach ($log as $key=>$val) {
$log_str .= "[".$key."]\n";
foreach($log[$key] as $nKey=>$nVal) {
$log_str .= "$nKey=$nVal\n";
}}
$fp = fopen($iniFile_path,'w');
fwrite($fp,$log_str);
fclose($fp);
?>
Does it work?
I don't know, just wrote it off the top of my head.
But, it should atleast give you a rudimentrary idea.