3v4l.org

run code in 300+ PHP versions simultaneously
<?php function expandShortUrl($shortUrl) { $context = stream_context_create(array( "http" => array( "method" => "HEAD", "follow_location" => 1, "ignore_errors" => 1 ) )); $headers = get_headers($shortUrl, 1, $context); if (isset($headers["Location"])) { return $headers["Location"]; } else { return $shortUrl; } } function expandShortUrls($shortUrls) { $expandedUrls = array(); foreach ($shortUrls as $shortUrl) { $expandedUrl = expandShortUrl($shortUrl); $expandedUrls[] = $expandedUrl; } return $expandedUrls; } // Kısa linkler $shortUrls = array( "https://www.etsy.com/listing/664135699", "https://www.etsy.com/listing/612721265", "https://www.etsy.com/listing/596197569", "https://www.etsy.com/listing/576635976", "https://www.etsy.com/listing/466790858", "https://www.etsy.com/listing/249127718", "https://www.etsy.com/listing/232208668", "https://www.etsy.com/listing/1741336387", "https://www.etsy.com/listing/1680069076", "https://www.etsy.com/listing/1659620413" ); // Kısa linkleri genişlet $expandedUrls = expandShortUrls($shortUrls); // Genişletilmiş linkleri yazdır foreach ($expandedUrls as $index => $expandedUrl) { echo ($index + 1) . ". " . $expandedUrl . "\n"; }
Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 Warning: get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/Vpkt6 on line 11 Warning: get_headers(): This function may only be used against URLs in /in/Vpkt6 on line 11 1. https://www.etsy.com/listing/664135699 2. https://www.etsy.com/listing/612721265 3. https://www.etsy.com/listing/596197569 4. https://www.etsy.com/listing/576635976 5. https://www.etsy.com/listing/466790858 6. https://www.etsy.com/listing/249127718 7. https://www.etsy.com/listing/232208668 8. https://www.etsy.com/listing/1741336387 9. https://www.etsy.com/listing/1680069076 10. https://www.etsy.com/listing/1659620413

preferences:
74.92 ms | 410 KiB | 65 Q