Good afternoon, in my area there is a provider with a large network (about 4000), you can enter the site without an internet connection. And few people come to the site with an internet connection. The server itself is connected to the Internet.

The essence of the question: how to make a weather script that will be updated only through the server. Additional information: My city Krivoy Rog (Ukraine).

  • Can it be updated somehow? - VioLet pm
  • Let it be updated through the server, but not through users. - Node_pro

1 answer 1

$pageContent = file_get_contents($url); // $url - адрес страницы с погодой 

And then, to taste - by regulars, according to DOM, somehow you can disassemble the page code, rip out the weather, show

  • More detail can be, please. - Node_pro 2:49 pm
  • Everything further depends on the specific task, page structure. The $ pageContent variable stores the html code of the weather page. And then the block is searched for in the code. For example, if a block with weather has id = 'weather', the regular expression is to find a line that is between "id =" weather "then different characters may appear, or not, then the> symbol (closing the tag)" and "< \ / div> "/id='weather'.*?>((.*?)<\\\/div>/ - Enpire
  • I did))) I found what I was looking for file_put_contents - to save the file to the server - Node_pro