I have the following code:
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$html = curl_exec($ch);
preg_match_all('|Set-Cookie: (.*);|U', $html, $results);
$cookies = implode(';', $results[1]);
$dom = new DOMDocument();
$dom->loadHTML($html);
on line $dom->loadHTML($html); I am getting the following error:
Warning: DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: Misplaced DOCTYPE declaration in Entity, line: 12 in D:\Programs\xampp\xampp\htdocs\ip\megafonmoscow.php on line 39 Warning: DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: htmlParseStartTag: misplaced tag in Entity, line: 13 in D:\Programs\xampp\xampp\htdocs\ip\megafonmoscow.php on line 39 Warning: DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: htmlParseStartTag: misplaced tag in Entity, line: 14 in D:\Programs\xampp\xampp\htdocs\ip\megafonmoscow.php on line 39 Warning: DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: Unexpected end tag : head in Entity, line: 32 in D:\Programs\xampp\xampp\htdocs\ip\megafonmoscow.php on line 39 Warning: DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: htmlParseStartTag: misplaced tag in Entity, line: 34 in D:\Programs\xampp\xampp\htdocs\ip\megafonmoscow.php on line 39
Is the line curl_setopt($ch, CURLOPT_HEADER, 1);
cause of this error? I need it because of the cookies. Any ideas on how to solve this?