G
G
Georgy Gorbachev2014-08-13 21:45:39
PHP
Georgy Gorbachev, 2014-08-13 21:45:39

How to configure the parser to unload several numbers from the page?

Good afternoon. There is a parser

<?php
    $content = file_get_contents('http://95.31.11.93:82/');
    $pos = strpos($content, 'Давление');
    $content = substr($content, $pos);
    $pos = strpos($content, 'mm');
    $content = substr($content, 8, $pos);
    echo $content;
    ?>

problemma when parsing with the link specified in the code, the parser displays:
748.0mm Влажand should display "748.0"
Help solve this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Batalin, 2014-08-13
@stalkerdj

$data = file_get_contents('http://95.31.11.93:82/');
preg_match('#Давление\s+([\d\.]+)mm#Uis', $data, $out);
echo $out[1];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question