My favorites | Sign in
Project Logo
                
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
<html><head><title>STD Identifier</title></head>
<body>
<h1>STD Code Identifier</h1>
<?php
$GLOBALS['THRIFT_ROOT'] = './thrift-php';
require_once($GLOBALS['THRIFT_ROOT'] . '/packages/std/STDService.php');
require($GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php');
require($GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php');

function lookup_number($number) {
$transport = new TBufferedTransport(new TSocket('localhost', 9090));
$protocol = new TBinaryProtocol($transport);
$client = new STDServiceClient($protocol);

$transport->open();
$info = $client->lookup($number);
$transport->close();

return $info;
}

if(isset($_GET['phone_number'])) {
$info = lookup_number($_GET['phone_number']);
?>
<p>Code Prefix: <?php echo $info['code_prefix'] ?></p>
<p>Area: <?php echo $info['area'] ?></p>
<p>State: <?php echo $info['state'] ?></p>
<?php
} else {
?>
<p>Type in your land line phone number with STD code to identify your city and state.</p>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>">
<label for="phone_number">Phone Number:</label>
<input type="text" name="phone_number" id="phone_number" value="" /><br />
<input type="submit" value="Find Info!" />
</form>
<?php
}
?>
</body>
</html>
Show details Hide details

Change log

r2 by g.vishnu on Jun 13, 2008   Diff
Initial commit.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1226 bytes, 41 lines
Hosted by Google Code