|
-
Mar 31st, 2006, 06:15 AM
#1
Thread Starter
Hyperactive Member
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
If there is only one perfect person in the universe, does that make them imperfect?
-
Mar 31st, 2006, 09:44 AM
#2
Thread Starter
Hyperactive Member
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.
If there is only one perfect person in the universe, does that make them imperfect?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|