its always the simple things (php fopen)
hey ho, so im changing everything over to databases.
I want to import CSV files from wherever and put them in my my sql database. I had a look on foru mand found a nice bit of code posted by Jeff which looked fine and thought to myself "cor that'll work just nicely" - see below
// connects to DB here
$handle = fopen("https:// users.buy.at/ menu/ productfeed_download.php?FORMAT=CSV&PRODUCTDB_ID=1 9 &DIRECT=yes","r");
while ($data = fgetcsv ($handle, 10000, ",")) {
$sql = "INSERT INTO products (product_name,brand_name, etc)
VALUES ('$data[0]', '$data[1]', '$data[2]', etc)";
$result = mysql_query($sql);
}
mysql_close($db);
the file its opening is the play.com datafeed on buy.at (spaces added so the link doesnt get spidered and buy.at bandwith get wasted)
I run the script and get:
Warning: fopen(#feed file as above#): failed to open stream: No such file or directory in /home/mysite/public_html/import/play.com.php on line 9
Warning: fgetcsv(): supplied argument is not a valid stream resource in /home/mysite/public_html/import/play.com.php on line 10
so it looks to me like its trying to open the file inside my site structure server type thing, but im not sure why? help much appreciated
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
|