iceblox Posted November 27, 2009 Share Posted November 27, 2009 Hi All, Im hoping you will be able to help me with these simple issues im having . 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 More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 Hi All, Im hoping you will be able to help me with these simple issues im having . 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 Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966614 Share on other sites More sharing options...
iceblox Posted November 27, 2009 Author Share Posted November 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966634 Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966660 Share on other sites More sharing options...
iceblox Posted November 27, 2009 Author Share Posted November 27, 2009 Hi abazoskib, I just tried using the basic example on their site <?php $compressed = 'my file'; $uncompressed = gzuncompress($compressed); echo $uncompressed; ?> Thanks for your continued help Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966671 Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 Any error messages? Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966672 Share on other sites More sharing options...
iceblox Posted November 27, 2009 Author Share Posted November 27, 2009 yeah i got Warning: gzuncompress() [function.gzuncompress]: data error in /usr/local/psa/home/vhosts/mysite.co.uk/httpdocs/testtest.php on line 35 Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966676 Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 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. Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966681 Share on other sites More sharing options...
iceblox Posted November 27, 2009 Author Share Posted November 27, 2009 ah no i missed that, thanks ill take another look. Link to comment https://forums.phpfreaks.com/topic/183156-two-fgetcsv-related-questions-d/#findComment-966685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.