Skip to content
Snippets Groups Projects
Commit b46708cb authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

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
No related branches found
No related tags found
3 merge requests!1895Development,!1797Development,!1794Resolve "Sometimes all results are marked as Affiliates"
...@@ -202,9 +202,11 @@ class RequestFetcher extends Command ...@@ -202,9 +202,11 @@ class RequestFetcher extends Command
curl_setopt_array($ch, $job["curlopts"]); 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_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_PROXYPORT, $this->proxyport);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
} }
......
...@@ -130,10 +130,21 @@ class Adgoal ...@@ -130,10 +130,21 @@ class Adgoal
try { try {
$answer = json_decode($answer, true); $answer = json_decode($answer, true);
foreach ($answer as $partnershop) { foreach ($answer as $partnershop) {
$targetUrl = $partnershop["url"]; $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) { foreach ($results as $result) {
if ($result->link === $targetUrl && !$result->partnershop) { if ($result->link === $targetUrl && !$result->partnershop) {
# Ein Advertiser gefunden # Ein Advertiser gefunden
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment