Save output in an xml file [closed]

You can download the contents of the given link to file.xml via Curl:

<?php
$url="https://services.boatwizard.com/bridge/events/ae0324ff-e1a5-4a77-9783-f41248bfa975/boats?status=on";
$fp = fopen (dirname(__FILE__) . '/file.xml', 'w+');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

Leave a Comment