3v4l.org

run code in 300+ PHP versions simultaneously
// урл https://hotline.ua/ua/auto-motocykly/aima-power-eagle/ <form name="parse" method="post"> <input type="url" name = "urlforparse" id="urlforparse" style="width: 350px; height: 65px; font-size: larger;"> <input type="cat" name = "categoo" id = "categoo"> <button class="button button--anthe" type="submit"><span>Парсить</span></button> </form> </html> <?php include('simple_html_dom.php'); $post = $_POST["urlforparse"]; $categoo = $_POST["categoo"]; $html = new simple_html_dom(); $html = file_get_html($post); // читаем страницу $name = $html->find('html body h1[class=title__main]', 0); // название товара //$arr = array('<h1 class="title__main" data-v-6623cabe>','</h1>'); $name = strip_tags($name); echo $name; $cod_sku = $html->find('html body span[data-qaid=product-sku]', 0); // код продукта $cod_sku = strip_tags($cod_sku); echo $cod_sku; $pric = $html->find('html body div span span[class=price__value]', 0); // цена товара $pri = preg_replace( // убираем все что НЕ цифры, // так как &nbsp; декодируется // НЕ в пробел, а другую сущность '/\D+/', '', html_entity_decode($pric) ); echo $pri. "<br>"; // выводим цену $pric = str_replace('&nbsp;', '', $pric); echo $pric. "<br>"; // выводим цену
Output for rfc.property-hooks, git.master_jit, git.master
// урл https://hotline.ua/ua/auto-motocykly/aima-power-eagle/ <form name="parse" method="post"> <input type="url" name = "urlforparse" id="urlforparse" style="width: 350px; height: 65px; font-size: larger;"> <input type="cat" name = "categoo" id = "categoo"> <button class="button button--anthe" type="submit"><span>Парсить</span></button> </form> </html> Warning: include(): open_basedir restriction in effect. File(simple_html_dom.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/IKP7B on line 11 Warning: include(simple_html_dom.php): Failed to open stream: Operation not permitted in /in/IKP7B on line 11 Warning: include(): Failed opening 'simple_html_dom.php' for inclusion (include_path='.:') in /in/IKP7B on line 11 Warning: Undefined array key "urlforparse" in /in/IKP7B on line 12 Warning: Undefined array key "categoo" in /in/IKP7B on line 13 Fatal error: Uncaught Error: Class "simple_html_dom" not found in /in/IKP7B:15 Stack trace: #0 {main} thrown in /in/IKP7B on line 15
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.31 ms | 1260 KiB | 4 Q