trinkaespinhas
New Member
I am trying to get html content of some remote site. I am using following php script but the output by this script is full of non-readable characters. I have no idea why it should behave like this. FYI, I am using chrome browser latest for my testing.Script:\[code\]<?php$url = "http://www.sandesh.com/article.aspx?newsid=115627";$curl = curl_init($url);curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);$output = curl_exec($curl);curl_close($curl);//echo $output;$DOM = new DOMDocument;@$DOM->loadHTML($output);//get all H1$items = $DOM -> getElementById('lblNews');echo $DOM -> getElementById('lblNews')->tagName;echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN''http://www.w3.org/TR/html4/loose.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><span>". $items -> nodeValue ."</span". "<br/></body></html>";//display all H1 text/*for ($i = 0; $i < $items -> length; $i++) { echo $items -> item($i) -> nodeValue . "<br/>";}*/?>\[/code\]Output:\[code\]span ? ?a?