<?php
class Provider
{
public $Name;
public $Url;
private $_func;
public function __construct($name, $url, $func)
{
$this->Name = $name;
$this->Url = $url;
$this->_func = Closure::bind($func, $this);
}
public function RetrieveUrl()
{
$url = call_user_func($this->_func);
return $url;
}
}
$providers = array();
$providers[] = new Provider("erodvert", "http://redirect.ero-advertising.com/speedclicks/in.php?pid=92999&spaceid=3546546&returnurl=", function () {
$html = file_get_contents($this->Url);
$regex = "/vars+ss+?=s+?['"](.*)['"]/i";
preg_match($regex, $html, $matches);
if ($matches) {
return "http://redirect.ero-advertising.com".$matches[1];
}
return "";
});
$arr = array_map(function ($p) {
return $p->RetrieveUrl();
}, $providers);
header('Content-type: application/json');
die(json_encode($arr));
برچسب:
نویسنده: آیلین رضوانی