开发者

How to retrieve number with prep_match_all()

开发者 https://www.devze.com 2022-12-11 00:48 出处:网络
Inside my webpage \"http://www.my_web_page\" I have something like that:img border=\"0\" class=\"borderx\" id=\"pic_15132\"

Inside my webpage "http://www.my_web_page" I have something like that: img border="0" class="borderx" id="pic_15132"

I wanna know which parameter did I have to use inside preg_match_all("") to retrieve only the number. Here is what I tried but my result is: _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>开发者_运维问答"; 
            }

Thanks,


$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>"; 
      }
0

精彩评论

暂无评论...
验证码 换一张
取 消