Hello
I’m working on an idea that involves using PHP to grab a .csv file and parse it...but the thing is that the .csv in question is on a third party server. Obviously I would be asking for permission to use the file...it’s nothing dodgy. My question is from the technical side of things on the server what are the issues involved ....being that it’s a third party environment that I’m not involved with.
Ie. Is it only possible if they don’t have a firewall or other restriction in place...or do I need to have CURL installed or my host needs to allow fsocketopen()
I thought I could use a code like this for example
Or perhaps I could use php’s ftp function or something.Code:<?php $fileTemp = "http://www.somethirdpartysite.com/folder/thecsvfile.csv"; $fp = fopen($fileTemp,'r'); $datas = array() while (($data = fgetcsv($fp)) !== FALSE) { $data['productName'] = trim($data[0]); $data['spec'] = trim($data[1]); $data['imageLocation'] = trim($data[2]); $datas[] = $data; } ?>
If anyone could advise I’d be grateful.
Thanks
Juan



Reply With Quote



Bookmarks