The remote file is an attachment, and i can get the headers but i cant get the file or the content of it.
<?php
error_reporting(E_ALL);
//not working, with rb too
//file_put_contents("natives.html", stream_get_contents(fopen("http://www.dev-c.com/nativedb/reference.html", 'r')));
//same with rb too
//file_put_contents("natives.html", fopen("http://www.dev-c.com/nativedb/reference.html", 'r'));
//same
//echo file_get_contents("http://www.dev-c.com/nativedb/reference.html");
//same
/*$url = 'http://www.dev-c.com/nativedb/reference.html';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, false);
curl_setopt($curl, CURLOPT_HEADER, true);
$data = curl_exec($curl);
curl_close($curl);
echo $data;*/
//same
$url = 'http://www.dev-c.com/nativedb/reference.html';
$file = basename($url);
$fp = fopen($file, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
So if i use any of those codes, the output is nothing, and the created file on my webserver is empty. The file: http://www.dev-c.com/nativedb/reference.html