Superfecta: Fix for DeTeMedien

I found the Superfecta “DeTeMedien” script did not work anymore, the result format seems to have changed.

I’ve fixed it by adding a line in the regexp array and changed the result at the end to overcome an error in case the name was not found. Full script:

<?php
/**
 * Developer Notes:
 * Discussion about TOS for this site here:
 * https://github.com/POSSA/Caller-ID-Superfecta/issues/167#issuecomment-31667257
 * Summary by github user Totole:  TOS: has no limitations besides reselling downloaded information’s
 *                                 to 3rd party. It belongs to Deutsche Telekom group.
 *
 * Version History
 *        2014-01-08   Initial migration to 2.11 and update regex's by lgaetz
 *        2014-03-25   Regex fix by Håkan
 *        2014-07-23   Regex fix by kossmac
 *        2025-08-11   Regex fix by JaCoTec
 */
class DeTeMedien_DE extends superfecta_base {


	public $description = "http://www.detemedien.de/";
	public $version_requirement = "2.11";
	
	function get_caller_id($thenumber, $run_param=array()) {
		$caller_id = null;
		$thenumber = (strlen($thenumber) > 0 && $thenumber[0] === '+') ? '00' . substr($thenumber, 1) : $thenumber;
		$this->DebugPrint(sprintf(_("Searching http://www.detemedien.de/ for %s..."),$thenumber));

		// url from ver. 2.2.x still working 2014-01-08
		$url = "http://www.dasoertliche.de/Controller?context=4&form_name=search_inv&action=43&page=5&ph=". $thenumber;

		// Patterns to search for
		$regexp = array(
			//          '/arkey=.*>(.*)&nbsp;/',    // old regex from ver 2.2.x occasionally gives bad result
			//          '/class="preview iname"><span class="">(.*?)<\/span><\/a> <\/span>/',   // working 2014-01-08
			//          '/class="preview iname" onmouseover="" onMouseOut=""><span class="">(.*?)<\/span>/',    // working 2014-07-23
			'/class="name " onmouseover="" onMouseOut=""><span class="">(.*?)<\/span>/',    // working 2014-07-23
			'/class="name "><span class="">(.*?)<\/span>/',    // working 2014-07-23
			'/class="name " onmouseover="" onmouseout=""><span class="">(.*?)<\/span>/',    // working 2014-07-23
			'/class="hitlnk_name">(.*?)<\/a>/',    // working 2025-08-11
		);

		if ($this->SearchURL($url, $regexp, $match, NULL, TRUE)) {
			$caller_id = $this->ExtractMatch($match);
		}
		$caller_id = isset($caller_id)?$caller_id:'';

		return($caller_id);
	}

}

Is there a Github repo where I can make a PR?

Edit:
DeTeMedien can’t deal with queries in international format (+49…). These must be changed to “0049…”.
This is achieved with the line

$thenumber = (strlen($thenumber) > 0 && $thenumber[0] === '+') ? '00' . substr($thenumber, 1) : $thenumber;

The same must be done in the “DasTelefonbuch” script!

BR,
Marco