Jump to content

Recommended Posts

Hi All,

 

I'm trying to set up some code to download a CSV file from an ftp host and then i want to do something with it.

 

However, i can't quite get the code to work. I get the following error:

 

Warning: ftp_get() [function.ftp-get]: Failed to open file. in /home/rsyr/restofthedirectories/ on line 8

 

Here's the code, excuse the messiness:

 

<?php
$today = date("Y-m-d");
$conn = ftp_connect("ftp.zois.co.uk") or die("Could not connect");
ftp_login($conn,"anonymous","");
echo "JCP-scrape-". $today;
echo ftp_get($conn,"JCP-scrape-18-10-2012.csv", "/pub/jcp/JCP-scrape-18-10-2012.csv",  FTP_ASCII);
ftp_close($conn);
//sql code to move data from holding table to vacancy table
//INSERT INTO vacancy (title, jobref, location, description, apply) SELECT title, reference, location, description, apply FROM holdingtable
//truncate holdingtable
//Holding table should then be truncated
?>

 

Thanks

Edited by ReeceSayer
Link to comment
https://forums.phpfreaks.com/topic/269682-ftp-issues-failed-to-open-file/
Share on other sites

You apparently copy/pasted the code from some rich-text/formatted source.

 

Please go back and copy/paste just the plain text from your programming editor.

 

It should have changed now i've edited the post, i copied it straight from Notepad++, not sure what the problem was.

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.