Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 18-11-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,752
Thanks: 3
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
  Unhappy 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 18-11-04
Retail-Therapy's Avatar
Can't Touch This
 
Join Date: May 2004
Location: КРОМИДОВО
Posts: 321
Thanks: 3
Thanked 0 Times in 0 Posts
Retail-Therapy is an unknown quantity at this point
Maybe the 'allow_url_fopen' setting in your php.ini is set to off, so, download the csv, then upload it to your server, then try it (or set it to on if you have access to the php.ini file.

Last edited by Retail-Therapy; 18-11-04 at 11:58 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 19-11-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,752
Thanks: 3
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
ta, any idea where i can edit this php.ini file, where it will be etc? its a big csv and im on dial up... shudder
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 19-11-04
Super Moderator
 
Join Date: Aug 2003
Posts: 2,451
Thanks: 0
Thanked 0 Times in 0 Posts
Rich is an unknown quantity at this point
Try changing https to http - it will still beable to get the file and I've found php sometimes struggles to make a https connection.

As retail-therapy said, it could also be allow_url_fopen, but I thought that gave a different error. To set it just add: -
PHP Code:
ini_set('allow_url_fopen','1'); 
before the $handle = fopen... line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 19-11-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,752
Thanks: 3
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
it was the https

thank you
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7