Is possible using external_acl or rewrite_program.
For programtion use C, Perl, PHP, ShellScript.
You need only return ERR
for negation or OK
for allow the access.
On external_acl you can pass to program any parrametres, url, port destination, port source, ip source, domain destionation, user.
basic example, allow access the "google"
#!/usr/bin/php -q
<?php
include "mysql.php";
include "funcoes.php";
$temp = array();
stream_set_timeout(STDIN, 86400);
if (!defined(STDIN)) {
define("STDIN", fopen("php://stdin", "r"));
}
while (!feof(STDIN)) {
$input = trim(fgets(STDIN));
$found = 0;
$login = 0;
$temp = split(' ', $input);
$output = $temp[0] . "\n";
$url_output = $output;
$url_output_debug = $temp[0];
$pos = strpos($url_output, 'google');
if ($pos !== false) {
$output = "OK \n";
$found = 1;
} else {
$output = "ERR \n";
}
fwrite(STDOUT, $output);
}
?>