Web Design and Development Forums

Trying something new... point me in the right direction?

This is a discussion on "Trying something new... point me in the right direction?" within the PHP Forum section. This forum, and the thread "Trying something new... point me in the right direction? are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > PHP Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Apr 17th, 2008, 21:39   #1 (permalink)
Reputable Member
 
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 217
Trying something new... point me in the right direction?

Hi, everyone! I'm trying something I've never done in php before and I'd appreciate some initial guidance...

The goal is to take a web page as input, parse it to extract the (few pieces of) data I need, then output it as a .png image.

My goal in doing this is to create an image which is updated hourly (and always saved with the same name) so that I can then schedule a task on my (Pocket PC) phone that will download this image hourly (at a few minutes past the hour), saving it locally on my phone so that I can quickly/easily/instantly view an updated surf report (without connecting to the actual webpage and without the hassles of mobile browsers!)

I'm OK using strpos and substr to find and extract the data I need, but I'm not sure how to read in a file and parse it line by line. And outputting text to an image file (I hope to use another image as the background - partially for aesthetics and partly to insure known/consistent file dimensions) seems to be somewhat of a black art!

If someone would be so kind as to point me toward the right php commands I'll need to look into, I can take it from there. Thanks in advance!
__________________
"There is no heavier burden than a great potential."~ Charlie Brown

Last edited by Donny Bahama; Apr 18th, 2008 at 06:14.
Donny Bahama is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 18th, 2008, 05:59   #2 (permalink)
Reputable Member
 
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 217
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.
__________________
"There is no heavier burden than a great potential."~ Charlie Brown
Donny Bahama is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Padding with rtl direction marSoul CSS Forum 0 Jan 23rd, 2008 14:14
Which Direction Should I Continue & Why? threelefts Free Web Site Critique 11 Nov 8th, 2007 01:21
Problem with re-direction Ed Hosting & Domains 2 Jul 7th, 2007 11:59
point me in the right direction camcool21 PHP Forum 1 Jan 24th, 2007 21:15
A Little Direction - Please just_the_basix ASP.NET Forum 1 Apr 22nd, 2004 05:37



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 10:58.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59