-
CSV string lines
Hi, I have been asked to organise this CSV file (http://intranet.pool.cornwall.sch.uk/weather/now.csv) using php. It logs the weather every 7 seconds aparently but it logs it like this:
Code:
1,2,3,4,5
1,2,3,4,5
how can i get it to output like this?
I have been stuck on this for like an hour now and dont know which function to use.
Thanks, dandono
-
Re: CSV string lines
I figured out i could just explode it so i did and got it working.
PHP Code:
<?php
$path="http://intranet.pool.cornwall.sch.uk/weather/now.csv";
$contents=stream_get_contents(fopen($path,"r"));
$thing=explode(",",$contents);
$val1=trim($thing[26],"PRNOW ");
$val2=trim($thing[26],$val1);
?>
$val1 & $val2 are done like that because there is no commas between line 1 and line 2 and i can't change it.