-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample-oop.php
63 lines (54 loc) · 1.12 KB
/
sample-oop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/php
<?php
/* $Id$ */
/*
* KRISP OOP style test file
*/
if ( ! extension_loaded ('krisp') ) {
if ( version_compare (PHP_VERSION, '5.4.0', '<') ) {
dl ('krisp.so');
} else {
fprintf (STDERR, "KRISP extension is not loaded\n");
exit (1);
}
}
$searches = array ('oops.org', 'kornet.net', 'yahoo.com', 'kldp.org');
try {
/*
* open krips database
*
* resource krisp_open (database)
*
* if failed, return FALSE
*/
#$kr = new KRISP ("/usr/share/krisp/krisp.dat", $err);
#$kr = new KRISP ('asdf', $err);
#$kr = new KRISP ('', $err);
#$kr = new KRISP (NULL, $err);
$kr = new KRISP ();
$kr->mtimeInterval (0);
$kr->debug ();
foreach ( $searches as $v ) {
/*
* search krsip database
*
* object KRISP::search (host)
* object KRISP::searchEx (host[, table='krisp'])
*/
$r = $kr->search ($v);
if ( $r === false )
continue;
print_r ($r);
$kr->debug (false);
#break;
}
/*
* close krisp database
*/
$kr->close ();
} catch ( KRISPException $e ) {
fprintf (STDERR, "%s\n", $e->getMessage ());
$err = preg_split ('/\r?\n/', $e->getTraceAsString ());
print_r ($err);
}
?>