Hey, Consider i have the follwing html syntax
<p>xyz</p>
<p>abc</p>
I want to retrieve the text (xyz and abc) using DOM.
This is my code.
<?php
$link='http://www.xyz.com';
$ret= getLinks($link);
print_r ($ret);
function getLinks($link)
{
    /*** return array ***/
    $ret = array();
    /*** a new dom object ***/
    $dom = new domDocument;
    /*** get the HTML (suppress errors) ***/
    @$dom->loadHTML(file_get_contents($link));
    /*** remove silly white space ***/
    $dom->preserveWhiteSpace = false;
    /*** get the links from the HTML ***/
    $text = $dom->getElementsByTagName('p');
/*** loop over the links ***/
    foreach ($text as $tag)
    {
        $ret[] = $tag->innerHTML;
    }
    return $ret;
}
?>
But i get an empty result. wat am i miissing here.?
 
     
     
    