Curl a file returned as octet-stream

Curl a file returned as octet-stream

I am trying to an get image output from a url. The url outputs a file to
download as octet-stream so the download file box appears if browsed from
browser. I am using curl to grab that file.
$url =
"http://www.ewallpapers.eu/download_wallpaper/green-heron-1600-1200-849.html";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
$downloaded = curl_exec($ch);
curl_close($ch);
echo $downloaded;
This outputs the file as well the page. How to extract only the file?