我需要一些幫助,使用我的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