Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class WhoCalled_UK extends superfecta_base {
- public $description = "http://who-called.co.uk - A datasource devoted to identifying telemarketers. These listings are provided by other users of this service.";
- public $version_requirement = "2.11";
- public $source_param = array(
- 'Get_SPAM_Score' => array(
- 'description' => 'Use who-called.co.uk for spam scoring (Harassing & Dangerous).',
- 'type' => 'checkbox',
- 'default' => 'on'
- )
- );
- function get_caller_id($thenumber, $run_param=array()) {
- //This debug variable allows simple copy and past of most sources.
- $debug = $this->debug;
- $caller_id = null;
- if (!$this->IsValidNumber('UK', $thenumber)) {
- $this->DebugPrint("Skipping Source - Non UK number: $thenumber");
- } else {
- $this->DebugPrint("Searching who-called.co.uk ... ");
- $url = "http://who-called.co.uk/Number/$thenumber";
- $value = $this->get_url_contents($url);
- $start = strpos($value, 'No comments yet');
- if ($start > 0) {
- $caller_id = ''; // Not a telepest
- $this->DebugPrint("not found");
- } else {
- $start = strpos($value, 'class="dataColumn">Harassing') || strpos($value, 'class="dataColumn">Dangerous');
- if ($start > 0) {
- if ($run_param['Get_SPAM_Score'] == 'on') {
- $this->spam = true; // Reported as a telepest
- $this->DebugPrint("SPAM caller");
- }
- }
- }
- }
- return($caller_id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement