Jump to content

[SOLVED] need extraction help


TFD3

Recommended Posts

Hi I am new to PHP and have gotten a lot better at it as time has went by.

I make whats known as place files for a software package and PHP scripts are needed to make some of these work right.

I am working on a new place file that I need php to make this work.

On this webpage http://www.abc3340.com/static/skycams/demopolis.html is a list of current conditions.

I need the temp extracted out of that URL but I am not sure how to go about doing this.

Can anyone give me advice?

 

any help what so ever it greatly appreciated!!

 

Thanks,

Kenny

Link to comment
Share on other sites

use the get method

 

$_GET['your_stuff_here'];

 

then the link should look something like this

href="x.php?your_stuff_here=ewan ko sayo"

 

now

echo $_GET['your_stuff_here']; will give you ewan ko sayo

 

;D does ti make sense

Link to comment
Share on other sites

use the get method

 

$_GET['your_stuff_here'];

 

then the link should look something like this

href="x.php?your_stuff_here=ewan ko sayo"

 

now

echo $_GET['your_stuff_here']; will give you ewan ko sayo

 

;D does ti make sense

 

not really. I need 72° extracted from that URL i posted.

I have not used the get method yet.

Link to comment
Share on other sites

on this page I just need the Temperature in blue along with the degree sign extracted. Can someone make a PHP script that can do just this using the URL thats posted above. I have no idea what im doing as I have not had to do this before. Im sure someone on here knows how ;)

Link to comment
Share on other sites

They might not like this but here is how you do it:

 

<?php

$handle = fopen("http://www.abc3340.com/static/skycams/demopolis.html", "r");
$contents = stream_get_contents($handle);
$pos = strpos($contents, "°");
$end = $pos - 3;
$string = substr($contents, $end, 4);
$string = str_replace('>', ' ', $string);
fclose($handle);

echo "$string";

?>

 

All you have to do is add whatever styling you want to the string which will only be the temperature.

Link to comment
Share on other sites

They might not like this but here is how you do it:

 

Well then all you have to do is change:

 

$handle = fopen("http://www.abc3340.com/static/skycams/demopolis.html", "r");

 

to

 

$handle = fopen("http://beta.alabamaweather.org/places/textversion/extra_stations/demopolis_raw.php", "r");

 

:o

 

Thanks for your help!!!

Link to comment
Share on other sites

NO, usually web sites do not want you accessing their pages without permission.

 

You need to check to see if it is copyrighted.

 

And the first code is what you need, just use wisely as it increases traffic on their site, and it will show your ip and other user information about you whenever you access the page(it will show the server you access the script from).

 

Cheers.

Link to comment
Share on other sites

NO, usually web sites do not want you accessing their pages without permission.

 

You need to check to see if it is copyrighted.

 

And the first code is what you need, just use wisely as it increases traffic on their site, and it will show your ip and other user information about you whenever you access the page(it will show the server you access the script from).

 

Cheers.

 

its not a problem, I have consent from the chief met at the station!

 

Link to comment
Share on other sites

Well there you go, you are lucky to have actually gotten permission, good job on that.

 

The script will work perfectly as long as the page remains fairly consistent to what it is now, it will go from -99 degrees all the way to 999 degrees, is that good enough?

 

;D

Link to comment
Share on other sites

Well there you go, you are lucky to have actually gotten permission, good job on that.

 

The script will work perfectly as long as the page remains fairly consistent to what it is now, it will go from -99 degrees all the way to 999 degrees, is that good enough?

 

;D

 

Yeah James Spann is a good met, he lets me use his skycam images as well!

Yeah I think -99 to 999 is a good rang, should be able to get every temp reported ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.