Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SEO/Metric/DomainAge.php')
-rw-r--r--plugins/SEO/Metric/DomainAge.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/SEO/Metric/DomainAge.php b/plugins/SEO/Metric/DomainAge.php
index e08dc3fa98..54038a7dae 100644
--- a/plugins/SEO/Metric/DomainAge.php
+++ b/plugins/SEO/Metric/DomainAge.php
@@ -74,7 +74,7 @@ class DomainAge implements MetricsProvider
*/
private function getAgeArchiveOrg($domain)
{
- $data = $this->getUrl('http://wayback.archive.org/web/*/' . urlencode($domain));
+ $data = $this->getUrl('https://wayback.archive.org/web/*/' . urlencode($domain));
preg_match('#<a href=\"([^>]*)' . preg_quote($domain) . '/\">([^<]*)<\/a>#', $data, $p);
if (!empty($p[2])) {
$value = strtotime($p[2]);
@@ -94,7 +94,7 @@ class DomainAge implements MetricsProvider
*/
private function getAgeWhoIs($domain)
{
- $data = $this->getUrl('http://www.who.is/whois/' . urlencode($domain));
+ $data = $this->getUrl('https://www.who.is/whois/' . urlencode($domain));
preg_match('#(?:Creation Date|Created On|created|Registered on)\.*:\s*([ \ta-z0-9\/\-:\.]+)#si', $data, $p);
if (!empty($p[1])) {
$value = strtotime(trim($p[1]));
@@ -114,7 +114,7 @@ class DomainAge implements MetricsProvider
*/
private function getAgeWhoisCom($domain)
{
- $data = $this->getUrl('http://www.whois.com/whois/' . urlencode($domain));
+ $data = $this->getUrl('https://www.whois.com/whois/' . urlencode($domain));
preg_match('#(?:Creation Date|Created On|created):\s*([ \ta-z0-9\/\-:\.]+)#si', $data, $p);
if (!empty($p[1])) {
$value = strtotime(trim($p[1]));
@@ -129,10 +129,21 @@ class DomainAge implements MetricsProvider
private function getUrl($url)
{
try {
- return str_replace('&nbsp;', ' ', Http::sendHttpRequest($url, $timeout = 10, @$_SERVER['HTTP_USER_AGENT']));
+ return $this->getHttpResponse($url);
+ } catch (\Exception $e) {
+ }
+
+ $httpUrl = str_replace('https://', 'http://', $url);
+ try {
+ return $this->getHttpResponse($httpUrl);
} catch (\Exception $e) {
$this->logger->warning('Error while getting SEO stats (domain age): {message}', array('message' => $e->getMessage()));
return '';
}
}
+
+ private function getHttpResponse($url)
+ {
+ return str_replace('&nbsp;', ' ', Http::sendHttpRequest($url, $timeout = 10, @$_SERVER['HTTP_USER_AGENT']));
+ }
}