Skip to content

Commit

Permalink
Fix: referer exception for Yahoo search
Browse files Browse the repository at this point in the history
  • Loading branch information
Daandelange committed Nov 11, 2021
1 parent 2445015 commit 2f947eb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/models/SimpleStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ public static function getRefererInfo( string $refHeader = null): ?array {
$urlParts = parse_url($refHeader);
if( $urlParts && isset($urlParts['host'])){
//var_dump($urlParts);
// Sanitize yahoo urls specifically ?
if( strpos($urlParts['host'], 'yahoo.com')!==false && isset($urlParts['path']) && ($cut=strpos($urlParts['path'], '_ylt')) && $cut !== false) $urlParts['path'] = substr($urlParts['path'], 0, $cut);
// Note: protocol and query strings are stripped
$returnData['url']=$urlParts['host'].(isset($urlParts['path'])?$urlParts['path']:'');//str_replace('www.','', $urlParts['host'].$urlParts['path'];
$returnData['host']=$urlParts['host'];
Expand Down

0 comments on commit 2f947eb

Please sign in to comment.