我需要一些帮助,使用我的php。我试图从html标签中获取名为streams
的元素列表。当我尝试从html标签获取元素时,它不会获取它,因为它会显示为空白。试图从html标记中获取元素时的空白元素
下面是代码:
<?php
//ini_set('max_execution_time', 1000);
error_reporting(0);
//$errmsg_arr = array();
//$errflag = false;
$baseUrl = file_get_contents('http://www.example.com/streams.php');
$domdoc = new DOMDocument();
$domdoc->strictErrorChecking = false;
$domdoc->recover=true;
@$domdoc->loadHTML($baseUrl);
$links = $domdoc->getElementById('streams');
echo $links;
?>
下面是HTML源:
<p id='channels'>BBC One South E</p><p id='streams'>http://www.example.com/live/35vlz78As8/191</p>
能否请你帮我我怎么能够从HTML的id获取元素标签?
..?请添加到您的代码 – scaisEdge
我很抱歉,但它显示为空白。 –
显示您用于打印/回显结果的代码 – scaisEdge