<?php

/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
UKPhoneInfo_UK dev notes:
October 17, 2013 - Change URL 
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/

class UKPhoneInfo_UK extends superfecta_base {

    public $description = "http://www.ukphoneinfo.com - The UK Telephone Code Locator will return the exchange or service area location. No names are returned by this source.<br>Because the data provided is less specific than other sources, this data source is usually configured near the bottom of the list of active data sources.";
    public $version_requirement = "2.11";

    function get_caller_id($thenumber, $run_param=array()) {
        $caller_id = null;
        $name = "";

        // Validate number
        if (!$this->IsValidNumber('UK', $thenumber)) {
            $this->DebugPrint("Skipping Source - Non UK number: {$thenumber}");
        } else {
            $this->DebugPrint('Searching UKPhoneInfo ...');

            $url = "http://www.ukphoneinfo.com/search.php?GNG={$thenumber}";

            if ($this->SearchURL($url, "=<h2[^>]*>(.*)</h2>=siU", $match)) {
                $caller_id = $this->ExtractMatch($match);
            }
        }
        return($caller_id);
    }

}