Question

I want to parse the news from the website which is : http://www.bakirkoykhb.gov.tr/?module=bizden_haberler , what i'm facing is the website has many tables without classes and very complicated and so on as you can see if you check the source code of the page, i get the headings like those ones :

Japonya-Türkiye Tıp Derneği'den Ziyaret

Saglık-Sen Gen. Başk.Memiş'ten Ziyaret

Vali Mutlu’ dan Ziyaret

and so on with my code below. but i don't have any idea that how can i parse the links which are contained under "Devamını Oku".

$html = file_get_html('http://www.bakirkoykhb.gov.tr/?module=bizden_haberler');
$j = 0;
foreach($html->find('b') as $element2){
echo "
<h3 ><a target=\"_blank\" href=\"#somethingtohere\">". $element2->plaintext . "</a></h3>
";
$j++;
if($j > 5) break;
}

Hope you can help, thank you.

Was it helpful?

Solution

This should do for you

echo "<h3 ><a href='http://www.bakirkoykhb.gov.tr/".$html->find('a',$j+22)->href."'>". $element2->plaintext . "</a></h3>";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top