The file that I have is:
$file_path='CSVs/data'.time().'TaskID_'.$this->task_id.'.csv';
Then I attach it to this function.
$save_to="Y:\SEO\Avi\BackLinks";
$this->download_remote_file(
"http://212.13.98.158/backlinks/".$file_path, $save_to);
function download_remote_file($file_url, $save_to)
{
$content = file_get_contents($file_url);
file_put_contents($save_to, $content);
}
That file should retrieve the files contents and copy it to the directory.
The errors that I get are to do with 404 and that the folder doesnt exist. But I do know for a fact, that the folder exists..and I am quite sure that the links is the right link that points to the resource
UPDATE:
mADE THE CHANGES..this simple example..throws me 403 forbidden. saying that the file or directory doesnt exist.
$save_to="Y:\SEO\Avi\BackLinks\data1335692353TaskID_122.csv";
$this->download_remote_file("http://212.199.198.158/backlinks/CSVs/data1335692353TaskID_122.csv", $save_to);
Look at your file_path:
212.13.98.15/backlinks/data1335692201TaskID_122.csv.It is not the path in the post:
$file_path='CSVs/data'.time().'TaskID_'.$this->task_id.'.csv';Remove the CSVs/
And what about the filename and its extention? You need them to tell under which name to write a file.
Your
$save_tohas to be a kind of$save_to="Y:\SEO\Avi\BackLinks\abc.cvs";UPDATE – Try each operation separately. First, echo the get_file_contents, or a few lines of it. Then try to put a simple “hello.txt” or whatever on your savepath.
If then you’ll recieve same error – check the permissions.