I have tried to get an Api from MyDramalist but I could not do it. Now I'm going to extract information from That using PHP. For example, how can I get the country?
My PHP Code:
<?php
$html = file_get_html($id_movie);
foreach ($html->find('.list-item') as $element) {
foreach ($element->find("b") as $subelement) {
// episode runtime
if(preg_match('/Duration/i', $subelement->innertext)){
preg_match_all('/[\d](,)?\d*/', $element->plaintext, $matches);
$runtime = implode(',', $matches[0]);
}
}
}
?>
My PHP code is not correct
The Output:
2,2
I need This Output:
2hr 2min
MyDramaList HTML :
<div class="box-body light-b">
<ul class="list m-b-0">
<li class="list-item p-a-0">
<b class="inline">Country:</b>
South Korea
<i class="flag flags-c3"></i>
</li>
<li class="list-item p-a-0">
<b class="inline duration">Duration:</b>
2 hr. 2 min.
</li>
<li class="list-item p-a-0 content-rating">
<b class="inline">Rating:</b>
13+ - Teens 13 or older
</li>
</ul>
</div>
Try :
$runtime = $matches[0][0]."hr ".$matches[0][1]."min";