Commit b46708cb authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '1085-sometimes-all-results-are-marked-as-affiliates' into 'development'

Resolve "Sometimes all results are marked as Affiliates"

Closes #1085

See merge request !1794
parents 0c5361a4 bea6ddbc
......@@ -202,9 +202,11 @@ class RequestFetcher extends Command
curl_setopt_array($ch, $job["curlopts"]);
}
if (!empty($this->proxyhost) && !empty($this->proxyport) && !empty($this->proxyuser) && !empty($this->proxypassword)) {
if (!empty($this->proxyhost) && !empty($this->proxyport)) {
curl_setopt($ch, CURLOPT_PROXY, $this->proxyhost);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxyuser . ":" . $this->proxypassword);
if(!empty($this->proxyuser) && !empty($this->proxypassword)){
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxyuser . ":" . $this->proxypassword);
}
curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
}
......
......@@ -130,10 +130,21 @@ class Adgoal
try {
$answer = json_decode($answer, true);
foreach ($answer as $partnershop) {
$targetUrl = $partnershop["url"];
$tld = $partnershop["tld"];
$targetHost = parse_url($targetUrl, PHP_URL_HOST);
/*
Adgoal sometimes returns affiliate Links for every URL
That's why we check if the corresponding TLD matches the orginial URL
*/
if($targetHost !== false && stripos($targetHost, $tld) === false){
continue;
}
foreach ($results as $result) {
if ($result->link === $targetUrl && !$result->partnershop) {
# Ein Advertiser gefunden
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment