
Apr 18th, 2008, 05:59
|
|
Reputable Member
|
|
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 233
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
|
Re: Trying something new... point me in the right direction?
Well, I've made good progress digging around on my own...
- PHP: Select all
<?php $i = 0; $text = " "; $lines = file('http://www.surfline.com/surf-report/oceanside-pier-ns-southern-california_4241/'); foreach ($lines as $line_num => $line) { if (strpos($line, 'CURRENT WEATHER') >= 1) { $i++; } elseif (strpos($line, 'SUNRISE/SET') >= 1) { $i--; } elseif (strpos($line, 'SURF:') >= 1) { $i++; } elseif (strpos($line, 'PM REGIONAL OVERVIEW:') >= 1) { $i--; }
if ($i == 1) { $notabs = array("\t", "\n"); $text = $text . str_replace($notabs, "", strip_tags($line)) . " "; } } $nocr = array(" WIND: ", " AIR/WATER: ", " SURF: "); $addcr = array("<br />\nWIND: ", "<br />\nAIR/WATER: ", "<br />\nSURF: "); $text = str_replace($nocr, $addcr, $text); $text = str_replace(" CURRENT WEATHER:", "CURRENT WEATHER: ", $text); print $text; ?>
It may not be as elegant as it might be, but it's achieving the desired result...
Input
Output
Now for the part that scares me - text-to-image.
|