I wanna get the titles and urls that has specific doc links. so, from the codes below, I wanna get informations : the Titles, and http://linkWeb.com that has specific url download .pdf http://link.pdf
Here's the html page :
<div class="title-download">
<div id="01divTitle" class="title">
<h3>
<a id="01Title" onmousedown="" href="http://linkWeb.com">Titles</a>
<span id="01LbCitation" class="citation">(<a id="01Citation" href="http://citation.com">Citations</a>)</span></h3>
</div>
<div id="01downloadDiv" class="download">
<a id="01_downloadIcon" title="http://link.pdf" onmousedown="" target=""><img id="ctl01_icon" class="small-icon";" /></a>
</div>
and here's the code, but it returns blank result :
<?php
include 'simple_html_dom.php';
set_time_limit(0);
$url ='http://example.com';
$html = file_get_html($url) or die ('invalid url');
foreach($html->find('span[class=citation]') as $link){
foreach($link->parent()->parent()->find('.download a') as $link2){ //I confused with the code in this line
if(strtolower(substr($link2->title, strrpos($link2->title, '.'))) === '.pdf') {
$link = $link->prev_sibling();
echo $link->plaintext.'<br>';
echo $link->href.'<br>';
echo $link2->title.'<br>';
}
}
}
?>
http://link.pdf? How does that work? Or is that just a dummy URL instead of publishing the actual site name?title"http://link.pdf"<- in the class download.