Solution 1 :

This how you can extract the data

<?php
// Load the HTML
$html = str_get_html('<div class="return-form">
                                <div class="two_cols">
                                    <div class="first_col">
                                        <label for="namesinger">Name:</label> </div>
                                    <div class="second_col">
                                        <p id="name">Axl Rose</p>
                                    </div>
                                </di');

// Locate the date via div ID and display
echo $html->find('p[id=name]', 0)->plaintext;
?>

For more details Read this

Problem :

Can you help me with the resolution below?
I have the following code in html:

<div class="return-form">
                                <div class="two_cols">
                                    <div class="first_col">
                                        <label for="namesinger">Name:</label> </div>
                                    <div class="second_col">
                                        <p id="name">Axl Rose</p>
                                    </div>
                                </div>

I am using the PHP Simple HTML DOM Parser library and I would like to display only the name “Axl Rose” on the screen.

echo ($ name)

expected exit
Axl Rose

Comments

Comment posted by The Alpha

'div[id=name]'

By