Evaluate web variable

Hello:

I would like to evaluate a variable from a website, but I don’t know if it is possible.

Could anybody help me?

I’m new in this forum, so I don’t know if I can write in English, but my German is poor. You can write in German, I can understand I little bit.

Thank you!

I moved your topic to our english section :slight_smile:

Could you explain a bit more what you meant with „evaluate“?

paresy

I would like to switch on my radiator or not depending the temperature that is in a weather station from the web.

Is it possible?

You need the text parser.
The WWW reader must be set as the parent instance to read the website.
Unfortunately the WWW reader is not documented further online.

It is possible to use the www reader and parser/cutter, but you can also read the content with native php.

Could you give us the webpage and the requested value?

The page is:http://mooddmae.upct.es:5001/est_meteo_peq2.html

But I’m not pretty sure what to do.

Isn’t it possible to program in PHP to save that value and then to evaluate it?

Thank you, I’m a little confussed about how could I do it.

I can access either with port(5001) specification still without it.
Is this a private site?
Show us the source text of this page!

I have just seen that it is a image. So the temperatura can be taken from this page:http://www.tutiempo.net/Estaciones/Cartagena/
the data I want is under Últimos datos registrados and is Temperatura, right know 16.1

The content structure of the page is not very parse friendly :(, so we do it in two steps.


<?

$content = file_get_contents( "http://www.tutiempo.net/Estaciones/Cartagena/" );

$start = 'Temperatura:<\/strong><\/td>';
$end = '°C<\/td>';
$result = preg_match_all("/$start(.*)$end/i", $content, $match);

$start = '>';
$end = '°C<\/td>';
$result = preg_match_all("/$start(.*)$end/i", $match[1][0], $match2);

echo "Temp: " . (float)$match2[1][0];

?>

Parsing web pages is a „bad solution“ because it is not sure that the result includes really the current data. You can never be sure that the data were consistent.
Small changes in page content by the provider within the $start and $end parts lead to errors.

It would be much better/safer to measure the temperature.

Thank you very much, so another question I have is that I don’t know what version is needed to buy, do you think that the basic version is enough?

Just start with the Basic version. You can upgrade at any time :slight_smile:

paresy

The basic version allows me to do all those function doesn’t it?

And have little experience with PHP, but I want to learn it well, are all the instructions in PHP?

I have bought the basic version, so I will try to do my first problem.

Thank you