I have no idea of what to do about this and I'm probably gonna get some down votes.
I have an web page similar to this:
<li class="specific-class">
<a href="http://unknown-url.com">Unknown Link</a>
</li>
I want to crawl a page filled with several other elements I'm not interested in retrieving.
I want to retrieve only the href
attribute in the anchor tag, within the li
element and nothing else. After which I will then follow the link and get another webpage that has something like this:
<h1 class="specific-class">Blah Blah Blah</h1>
So at the end of it all, I'll get whatever is in the h1
element:
Blah Blah Blah
If you guys could help me get around this I'd greatly appreciate. Also, any API's will do nicely.
I have this piece of code that gets attributes from an element but I've not been able to get it to crawl elements found within a specific element.
<?php
include_once('simple_html_dom.php');
$target_url = "https://www.google.com/";
$html = new simple_html_dom();
$html->load_file($target_url);
foreach($html->find('a') as $link){
echo $link->href."<br>";
}
?>