Skip to content

Instantly share code, notes, and snippets.

@MitMaro
Last active May 7, 2018 20:57
Show Gist options
  • Save MitMaro/e607676274e98c0364ea4108622bdfec to your computer and use it in GitHub Desktop.
Save MitMaro/e607676274e98c0364ea4108622bdfec to your computer and use it in GitHub Desktop.
Redirect to Winsome Way
<?php
$host = "https://share.delorme.com/feed/share/winsomeway";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($result);
$data = $xml->Document->Folder->Placemark->ExtendedData->children();
$lat = '';
$long = '';
foreach ($data as $d) {
if ((string)$d->attributes()->name == "Latitude") {
$lat = (string)$d->value;
}
if ((string)$d->attributes()->name == "Longitude") {
$long = (string)$d->value;
}
}
?>
Redirecting...
<script>
window.location = "https://www.windy.com/?<?php echo $lat ?>,<?php echo $long ?>,9"
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment