I'm using php to get a part of a html file:
HTML file:
<div class="titles">
<h2><a href="#">First Title</a></h2>
</div>
PHP file:
<?php
include_once('simple_html_dom.php');
$url = 'http://example.com';
$html = file_get_html($url);
$titles = $html->find('.titles');
$heading = $titles->find('h2')[0];
$link = $heading->find('a')[0];
echo $link;
//result: <a href="#">First Title</a>
?>
How can I separately get the value of href and 'a' tag?
Because I want to save the title and link into the database,
I need '#' and 'First Title' not the 'a' tag.