Last active
February 4, 2022 20:36
-
-
Save KennyStier/0fccbfcce1126d4b9c799a4598193b88 to your computer and use it in GitHub Desktop.
Get latest UPS Ground delivery time map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date = date("mdY"); | |
$upspage = file_get_contents("https://www.ups.com/maps/printerfriendly?loc=en_US&usmDateCalendar=".$date."&stype=O&zip=47240"); | |
preg_match('/\/using.*\.gif/', $upspage, $output_array); | |
header('Content-type: image/png'); | |
$url = "https://www.ups.com".$output_array[0]; | |
$headers = @get_headers($url); | |
if($headers && strpos( $headers[0], '200')) { | |
echo file_get_contents($url); | |
} | |
else { | |
echo file_get_contents("https://cloudfree.shop/ups-map-fallback.gif"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment