Jump to content

Two fgetcsv related questions ;D


iceblox

Recommended Posts

Hi All,

 

Im hoping you will be able to help me with these simple issues im having ;D.

 

First of im trying to get a file from a merchants server but the directory is protected, I know the user and pass obviously but im wondering how i can pass the login details through to the script automatically as i run the job as a cron.

 

Secondly i cant seem to find any information on this but i also have a gzip file im trying to open using fgetcsv, do i need to add anything to get this to work, does fopen suffice for this or is there a better function for this?

 

Thanks, Phil

Link to comment
https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/
Share on other sites

Hi All,

 

Im hoping you will be able to help me with these simple issues im having ;D.

 

First of im trying to get a file from a merchants server but the directory is protected, I know the user and pass obviously but im wondering how i can pass the login details through to the script automatically as i run the job as a cron.

 

Secondly i cant seem to find any information on this but i also have a gzip file im trying to open using fgetcsv, do i need to add anything to get this to work, does fopen suffice for this or is there a better function for this?

 

Thanks, Phil

 

For the user password try this: http://username:[email protected]/path/to/file

 

You can't directly open a gzip as far as I know. Try this out though: http://www.php.net/manual/en/function.gzuncompress.php

Hi abazoskib,

 

Thanks for your suggestions, I have implemented the username and password thing works a treat thank you!

 

Still struggling with the other, your suggestion unfortunately didnt work. Ive been thinking to open it then copy it from its location as its a zipped csv file to a csv file on my local server but again it need to get it open to begin with lol

 

Thanks for your help, Phil

Hi abazoskib,

 

Thanks for your suggestions, I have implemented the username and password thing works a treat thank you!

 

Still struggling with the other, your suggestion unfortunately didnt work. Ive been thinking to open it then copy it from its location as its a zipped csv file to a csv file on my local server but again it need to get it open to begin with lol

 

Thanks for your help, Phil

 

Post the code you tried using, without giving away critical information like usernames passwords actual URLs etc etc

yeah i got

 

Warning: gzuncompress() [function.gzuncompress]: data error in /usr/local/psa/home/vhosts/mysite.co.uk/httpdocs/testtest.php on line 35

 

Im guessing you didn't read the entire documentation. Somone posted a workaround for the exact problem you are having a little farther down the page.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.