Getting a remote file to local storage
I'm not very familiar with cURL either, but looking at the documentation I noticed a curl_setopt_array() function that may be worth looking into.

$options = array(
    CURLOPT_HEADER =&gt; FALSE,
    CURLOPT_URL =&gt;  $url,
    //etc...
);

curl_setopt_array( $curl_handle, $options );


Looking at the documentation for curl_exec() shows that the only time its output will be FALSE is on failure. The only time it is really necessary to compare a value explicitly with a boolean is if that value will at some point be a boolean and at all other times won't, but may be mistaken for it (0, '', 'false', etc...). However, at this point you would then use absolute equality comparison instead of a loose one. For instance, the below example will output "asdf", "false", '', and 0 from the first if statement, but the second and third if statements will only ever output "asdf". This is because the first if statement uses an absolute, or strict, comparison to the boolean. The third if statement shows a cleaner way of doing the second. Any variable you can loosely compare with a boolean, can loosely be used as a boolean, so there's no need to type out the actual comparison. I would use that last if statement because its not likely you want to create an empty file, and unless you have a file with only a "false" value in it, then you are not likely to notice the difference.

$buffer = array( FALSE, 'asdf', 'false', '', 0 );

foreach( $buffer AS $test ) {
    if( $test !== FALSE ) {//absolute
        var_dump( $test );
    }
    if( $test != FALSE ) {//loose
        var_dump( $test );
    }
    if( $test ) {//another way of writing loose
        var_dump( $test )
    }
}


The only other thing I would suggest here is that you verify that your $xml_file exists before trying to write to it.

if( $buffer &amp;&amp; is_file( $xml_path . $xml_file ) ) {