简体   繁体   English

使用php curl或file_get_content获取div值

[英]grab a div value using php curl or file_get_content

<fieldset>
<h2 class="fs-title">Success !</h2>
<h3 class="fs-subtitle">Here is the MAC Address and the Password associated with the User ID provided.</h3>
<div id="wrapper">
<input type="text" id="search" style="text-transform: uppercase;" value="c864c7cf605d" readonly="">
</div>
<div id="wrapper">
<input type="text" id="search" style="height: 55px;" value="123456" readonly="">
</div>
</fieldset>

here , i just want to grab this c864c7cf605d value using curl or file_get_content , how can i do that ? 在这里,我只想使用curl或file_get_content来获取此c864c7cf605d值,我该怎么办?

Here is some code to help you to get started: 以下代码可帮助您入门:

<?php

$content = '
<fieldset>
<h2 class="fs-title">Success !</h2>
<h3 class="fs-subtitle">Here is the MAC Address and the Password associated with the User ID provided.</h3>
<div id="wrapper">
<input type="text" id="search" style="text-transform: uppercase;" value="c864c7cf605d" readonly="">
</div>
<div id="wrapper">
<input type="text" id="search" style="height: 55px;" value="123456" readonly="">
</div>
</fieldset>';

preg_match('/value="(.+?)"/', $content, $result);
echo $result[1];
?>

The output is: c864c7cf605d 输出为: c864c7cf605d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM