image.php 708 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. $images = [
  3. "https://f4.bcbits.com/img/" . urlencode($_GET["file"]),
  4. "https://f4.bcbits.com/img/a" . urlencode($_GET["file"])
  5. ];
  6. foreach ($images as $image) {
  7. $ch = curl_init($image);
  8. curl_setopt($ch, CURLOPT_NOBODY, true);
  9. curl_exec($ch);
  10. if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200) {
  11. curl_setopt($ch, CURLOPT_NOBODY, false);
  12. curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($ch, $data) {
  13. echo $data;
  14. return strlen($data);
  15. });
  16. $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
  17. header("Content-Type: " . ($contentType ?: "application/octet-stream"));
  18. curl_exec($ch);
  19. break;
  20. };
  21. };
  22. ?>