Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Grabbing A Remote URL

Posted on 2000-05-11
7
Medium Priority
?
211 Views
Last Modified: 2006-11-17
I am trying to get the information from http://lumahai.soest.hawaii.edu/cgi-bin/text2.csh?SURFOBS.PHFO,Surf_Observations,Hawaiian_Weather and post it on a local page.

I can get the info fine but I want to display only part of the page. Here are the parts I don't want to show:

- Anything before the actual start of the report.

- And nothing after the end of the report. IE: Not the horizontal rules.

Any ideas?
0
Comment
Question by:phreakin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:us111
ID: 2800714
Which part would you like ??


FZHW50 PHFO 110000
NSHHFO
SURF OBSERVATIONS AT SELECTED OAHU BEACHES
NATIONAL WEATHER SERVICE HONOLULU HI
2 PM HST WED MAY 10 2000
AFTERNOON  

BEACH             HEIGHTS               REMARKS

EHUKAI             FLAT TO 1              1 PM
SUNSET             FLAT TO 1              1 PM
MAKAPUU            2 TO 4                 1 PM
SANDY BEACH        2 TO 4                 1 PM
DIAMOND HEAD       2 TO 3 OCNL 4          7 AM
WAIKIKI            2 TO 3                 1 PM
ALA MOANA          2 TO 3                 1 PM
NANAKULI           FLAT TO 1              9 AM
MAKAHA             FLAT TO 1              1 PM

SURF ALONG THE SOUTH SHORES WILL BE 1 TO 3 FT TODAY AND WILL
BECOME HIGHER WITH HEIGHTS OF 3 TO 5 FT BY LATE AFTERNOON AND
THURSDAY.

SURF ALONG THE EAST AND WEST SHORES WILL BE 2 TO 3 FT OCNL 4 FT
THROUGH THURSDAY.

SURF ALONG THE NORTH SHORES WILL BE FLAT TO 1 FT THROUGH
THURSDAY.
0
 

Author Comment

by:phreakin
ID: 2800739
SURF OBSERVATIONS AT SELECTED OAHU BEACHES
NATIONAL WEATHER SERVICE HONOLULU HI
2 PM HST WED MAY 10 2000
AFTERNOON    

BEACH             HEIGHTS               REMARKS

EHUKAI             FLAT TO 1              1 PM
SUNSET             FLAT TO 1              1 PM
MAKAPUU            2 TO 4                 1 PM
SANDY BEACH        2 TO 4                 1 PM
DIAMOND HEAD       2 TO 3 OCNL 4          7 AM
WAIKIKI            2 TO 3                 1 PM
ALA MOANA          2 TO 3                 1 PM
NANAKULI           FLAT TO 1              9 AM
MAKAHA             FLAT TO 1              1 PM

SURF ALONG THE SOUTH SHORES WILL BE 1 TO 3 FT TODAY AND WILL
BECOME HIGHER WITH HEIGHTS OF 3 TO 5 FT BY LATE AFTERNOON AND
THURSDAY.

SURF ALONG THE EAST AND WEST SHORES WILL BE 2 TO 3 FT OCNL 4 FT
THROUGH THURSDAY.

SURF ALONG THE NORTH SHORES WILL BE FLAT TO 1 FT THROUGH
THURSDAY.

0
 
LVL 8

Expert Comment

by:us111
ID: 2801742
ok, below is the HTML source of the page.
Is the HTML source always the same ??
I mean
<pre>
FZHW50 PHFO 110000
NSHHFO
blablabla
</pre> ?

And you need blablabla...

Do you already have these 2 lines ??

FZHW50 PHFO 110000
NSHHFO

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:phreakin
ID: 2801761
I would assume those lines change, I just need to get the info from the report. The only really important part to chop off would be the bottom part. I could live with the rest.
0
 

Accepted Solution

by:
Agent_Neo earned 150 total points
ID: 2802250
Here is the script in php to do what you want.

<?php
### Grab URL DATA ###
$url_report = fopen("http://lumahai.soest.hawaii.edu/cgi-bin/text2.csh?SURFOBS.PHFO,Surf_Observations,Hawaiian$

### Parse Report Lines ###
while (!feof($url_report)) {
  $buffer = fgets($url_report, 4096);
  if ($buffer == "<HR>\n") { $found=true; } # Cut off Area
  if ($found == true) {
        Skip;
  }
        else {
                if ($buffer != "<pre>\n" && $buffer != "</pre>\n") { $data .= $buffer;}
  }

}
### Close Report ###
fclose($url_report);

$data = strip_tags($data); # Strip HTML Tags
print $data; # Print Report

?>
0
 

Expert Comment

by:Agent_Neo
ID: 2802258
My Bad. I was copying from Pico (Linux) and din't see I didnt copy all the code:

Where it says:
$url_report

Replace it with this:
$url_report = fopen("http://lumahai.soest.hawaii.edu/cgi-bin/text2.csh?SURFOBS.PHFO,Surf_Observations,Hawaiian_Weather","r");
0
 
LVL 8

Expert Comment

by:us111
ID: 2803446
Less code and only one access to the URL:

<?
$url_report = file("http://lumahai.soest.hawaii.edu/cgi-bin/text2.csh?SURFOBS.PHFO,Surf_Observations,Hawaiian_Weather");

$new_url="";
while (list($index, $value) = each($url_report))
{       $new_url.="<br>".$value;
}

$new_url = split("<pre>", $new_url);
$new_url = split("</pre>", $new_url[1]);
print $new_url[0];
?>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question