<?php

/**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****
 * Development notes:
 * Previous versions of this module would check for valid Argentina number format by using:
 * $this->IsValidNumber('AR', $this->thenumber, $areacode, $number2, $number3)
 * but this did not appear to be working properly and requires maintenance of the AR area code list. This check
 * abandoned on July 29, 2013
 * 
 * Change log:
 *		2013-07-29 - remove valid number check, update URL and update regex
 *		2014-04-07 - Update URL and regex
 *		2014-07-11 - Add regex for business name matching
 *		2014-08-05 - Updated URL
 *
 *
 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****/

class Paginasblancas_AR extends superfecta_base {

	public $description = "Searches Argentina http://www.paginasblancas.com.ar/";
	public $version_requirement = "2.11";

	function get_caller_id($thenumber, $run_param=array()) {

		$this->DebugPrint("Searching www.paginasblancas.com.ar for number: $thenumber");

		$url = "http://www.paginasblancas.com.ar/telefono/".$thenumber;    //updated 2014-08-05
		$pattern = array(
			'/<a class="no-link" rel="nofollow" href="javascript:void.0.;">(.*?)<\/a>/',      //updated 2014-04-07 for residential
			'~<h3 class="m-results-business--name" itemprop="name">.*?<a  href=".*?">(.+?)</a>.*?</h3>~s',  // added 2014-07-11 for business
		);




		if ($this->SearchURL($url, $pattern, $match)) {
			$caller_id = $this->ExtractMatch($match);
		}
	return($caller_id);
	}

}