Domanda

All'interno mia pagina web " http: //www.my_web_page " Ho qualcosa di simile: border img = "0 "class =" borderx" id = "pic_15132"

Voglio sapere quale parametro ho dovuto utilizzare all'interno preg_match_all ( "") per recuperare solo il numero. Ecco quello che ho provato, ma il mio risultato è: _15132

$webpage = file_get_contents("http://www.my_web_page");

   preg_match_all("#_([^>]*)[0-9]{6}#", $webpage , $matches)
        foreach($matches[0] as $value) 
            { 
                echo $value . "<br>"; 
            }

Grazie,

È stato utile?

Soluzione

$webpage = file_get_contents("http://www.my_web_page");

preg_match_all("#_[^>]*([0-9]{6})#", $webpage , $matches)
   foreach($matches[1] as $value) 
      { 
          echo $value . "<br>"; 
      }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top