fork download
  1. <?php
  2. // TikTok video URL
  3. $tiktok_url = "https://w...content-available-to-author-only...k.com/@maligoshik/video/7472584144510373125";
  4.  
  5. // Get the page content
  6. $context = stream_context_create(array('http' => array('header' => 'User-Agent: Mozilla/5.0')));
  7. $html = file_get_contents($tiktok_url, false, $context);
  8.  
  9. // Extract the thumbnail URL from Open Graph meta tag
  10. preg_match('/<meta property="og:image" content="(.*?)"/', $html, $matches);
  11. $thumbnail_url = $matches[1] ?? 'https://v...content-available-to-author-only...r.com/300x400?text=No+Thumbnail';
  12.  
  13. // Display the thumbnail
  14. echo '<img src="'.$thumbnail_url.'" alt="TikTok Thumbnail" style="max-width:100%; height:auto;">';
  15. ?>
  16.  
Success #stdin #stdout #stderr 0.03s 26164KB
stdin
Standard input is empty
stdout
<img src="https://v...content-available-to-author-only...r.com/300x400?text=No+Thumbnail" alt="TikTok Thumbnail" style="max-width:100%; height:auto;">
stderr
PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/yk7HoC/prog.php on line 7
PHP Warning:  file_get_contents(https://...@maligoshik/video/7472584144510373125): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/yk7HoC/prog.php on line 7