Answer the question
In order to leave comments, you need to log in
PHP: str_get_html is not looking for half of the tags, what could be?
Code example
$curl = curl_init('https://myzuka.fm/Song/6141700/Alekseev-Pyanoe-Solntse-Ser-L-Uk-Remix');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
$content = curl_exec($curl);
$htmlSong = str_get_html($content);
print_r(count($htmlSong->find('body')));
exit;
Answer the question
In order to leave comments, you need to log in
The html code of the site contained many errors, the simple html dom library could not cope with the task.
Solution: switched to DomCrawler from symfony
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question