remove anchor from source URLs
authorChristian Weiske <cweiske@cweiske.de>
Thu, 1 Sep 2016 05:38:08 +0000 (07:38 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 1 Sep 2016 05:38:08 +0000 (07:38 +0200)
src/phinde/Helper.php
src/phinde/LinkExtractor/Html.php

index 43345ba22899c890966c5a659bda068b0daebbe6..8e30a198609af00075f4994441ad83dc81dcfe53 100644 (file)
@@ -31,6 +31,12 @@ class Helper
         return 'http://' . $url;
     }
 
+    public static function removeAnchor($url)
+    {
+        $parts = explode('#', $url, 2);
+        return $parts[0];
+    }
+
     public static function sanitizeTitle($str)
     {
         return trim(
index 7b987e3280fa0b298c7c0f9b2ef774eb15cc5a87..b3a9ea65170f8f50bd5a09492c72eb7e028829f3 100644 (file)
@@ -8,7 +8,7 @@ class Html
 {
     public function extract(\HTTP_Request2_Response $res)
     {
-        $url = $res->getEffectiveUrl();
+        $url = Helper::removeAnchor($res->getEffectiveUrl());
 
         $linkInfos = array();