получить значение div, используя php curl или file_get_content

0
<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>

здесь, я просто хочу захватить это значение c864c7cf605d с помощью curl или file_get_content, как я могу это сделать?

  • 1
    Как я могу это сделать? ... Прилагая усилия и показывая нам, что вы пытались и как это не удалось. Я предлагаю прочитать в domdocument и xpath что вы хотите
Теги:
curl
file-get-contents

1 ответ

0
Лучший ответ

Вот несколько кодов, которые помогут вам начать работу:

<?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];
?>

Выход: c864c7cf605d

  • 0
    спасибо @antoan milkov

Ещё вопросы

Сообщество Overcoder
Наверх
Меню