Example #1
0
            $links[] = parse_url($e->href)["host"];
        }
        $links = array_unique($links);
        return $links;
    }
}
class PrintUrl
{
    private $links;
    public function __construct()
    {
    }
    public function action($links = null)
    {
        foreach ($links as $link) {
            echo $link;
            echo "\n";
        }
    }
}
if ($argc != 1) {
    $url = $argv[1];
    $PageDownload = PageDownload::getInstance();
    $Page = $PageDownload->action($url);
    $Links = new ParseUrl();
    $LinksResult = $Links->action($Page);
    $PrintUrl = new PrintUrl();
    $PrintUrl->action($LinksResult);
} else {
    echo 'Error data';
}
Example #2
0
        $array_link = [];
        foreach ($out[1] as $k => $v) {
            // Prepend the URL with the $base URL (if needed)
            if (strpos($v, $parse['scheme'] . '://') === false) {
                $v = $parse['host'] . $v;
            }
            array_push($array_link, $v);
        }
        return $array_link;
    }
    /**
     * Display find images
     *
     * @return bool
     */
    public function display()
    {
        $result = !empty($this->result);
        if ($result) {
            foreach ($this->result as $link) {
                echo '<a href="' . $link . '">' . $link . '</a><br/>';
            }
        }
        return $result;
    }
}
$par = new ParseUrl('https://habid.com/auctions?tab=shop');
if (!$par->display()) {
    echo $par->error;
}
die;
Example #3
0
 public static function getUrlVisits($url)
 {
     $purl = ParseUrl::decode($url);
     if ($purl['host'] != $_SERVER['HTTP_HOST']) {
         return UrlStatBehavior::getHits($url);
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('hash ="' . $purl['hash'] . '"');
     $count = LogVisitor::model()->count($criteria);
     return $count;
 }