|
|
@@ -8,21 +8,22 @@ if ( ! empty( $_GET['preview'] ) ) {
|
|
|
} else {
|
|
|
$slug = get_post_meta(get_the_ID(), '_slug_zrzutka', true);
|
|
|
}
|
|
|
-
|
|
|
+ if (false === ($html = get_transient($slug))) {
|
|
|
+ $url = "https://zrzutka.pl/" . $slug;
|
|
|
+
|
|
|
+ // Używamy cURL do pobrania zawartości strony
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
|
|
|
+ // curl_setopt($ch, CURLOPT_STDERR, $wrapper);
|
|
|
+
|
|
|
+ $html = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
|
|
|
-
|
|
|
- $url = "https://zrzutka.pl/" . $slug;
|
|
|
-
|
|
|
- // Używamy cURL do pobrania zawartości strony
|
|
|
- $ch = curl_init();
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
- curl_setopt($ch, CURLOPT_VERBOSE, true);
|
|
|
- // curl_setopt($ch, CURLOPT_STDERR, $wrapper);
|
|
|
-
|
|
|
- $html = curl_exec($ch);
|
|
|
- curl_close($ch);
|
|
|
+ set_transient($slug, $html, 60 * 15);
|
|
|
+ }
|
|
|
|
|
|
// Sprawdzamy, czy udało się pobrać zawartość
|
|
|
if (!$html) {
|