@curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network');
+ $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
return $curlResponse;
}
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network');
+ $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
Logger::log('post_url: end ' . $url, Logger::DATA);
* @param string $url The url to check the domain from
*
* @return boolean
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function isUrlBlocked($url)
{
$http_code = $curl_info['http_code'];
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network");
+ $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
if ($http_code == 0) {
return $url;
$body = curl_exec($ch);
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network");
+ $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
if (trim($body) == "") {
return $url;
(strlen($query) ? "?".$query : '') .
(strlen($fragment) ? "#".$fragment : '');
}
+
+
+ /**
+ * Switch the scheme of an url between http and https
+ *
+ * @param string $url URL
+ *
+ * @return string switched URL
+ */
+ public static function switchScheme($url)
+ {
+ $scheme = parse_url($url, PHP_URL_SCHEME);
+ if (empty($scheme)) {
+ return $url;
+ }
+
+ if ($scheme === 'http') {
+ $url = str_replace('http://', 'https://', $url);
+ } elseif ($scheme === 'https') {
+ $url = str_replace('https://', 'http://', $url);
+ }
+
+ return $url;
+ }
}