Google
 

Tuesday, June 14, 2011

NTC PSTN Number to Name

NTC's website has a nice feature called Telephone search. This is particularly handy when you get a call from landline (PSTN) number and have no idea who's calling. Ofcourse you can go to the site and search, but the following bash script makes it faster.

#!/bin/bash

#
# Nepal Telecom PSTN Number to Name search
#

if [ "$1" == "" ] ; then
echo "Usage: " $0 "phone_number"
exit
fi

# Prefix 01, if not provided
if [[ $1 =~ ^01 ]] ; then
NUMBER=$1
else
NUMBER="01$1"
fi

wget -q http://ntc.net.np/telsearchRes.php
--post-data "searchFor=name&telno=$NUMBER&submitted=Search" -O - | html2text | grep "$NUMBER" | tr '_' ' ' | sed 's/ [\ ]*/ /g'

Save the file, chmod it as executable.

To use,
./telsearch 5544132
| 1 |015544132|Ntc |Cellular Mobile And New S|Jawalakhel|

6 comments:

  1. Jwalanta,
    Your script is good, but NT's database is crappy.
    I searched my home phone number. It shows some other guy's name. :)

    ReplyDelete
  2. Cool!
    You know one can easily reap it. Just give % as Username :D

    ReplyDelete
  3. It seems a great research of NTC. This service is very helpful for everyone who wants to know about name of the person who's calling.

    ReplyDelete
  4. looks like this does not work anymore!! :(

    ReplyDelete