2017-02-23 7 views
0

外部のURLから公式の日付と時刻を取得しようとしていますが、PHPスクリプトでは必要な値が返されません。あなたは私を助けてくれるほど親切ですか?外部のURLから公式の日時を取得する

<?php 
// example of how to use basic selector to retrieve HTML contents 
require_once('simplehtmldom/simple_html_dom.php'); 

// get DOM from URL or file 
$html = file_get_html('http://www.cenam.mx/hora_oficial/'); 

// get and show the Mexico Center's Time 
$hcentro = $html->find('div[id=hcentro]', 0)->innertext; 
echo 'hcentro: '. $hcentro; 

// get and show the Mexico Center's Date 
$fcentro = $html->find('div[id=fcentro]', 0)->innertext; 
echo 'fcentro: '. $fcentro; 
?> 

私は単純に取得結果は以下の通りです: hcentro:fcentro:

何もありません。どうして?私は間違って何をしていますか?他のdivため

Tiempo del Centro</strong> 
<div style="FONT-SIZE: 15pt;font-weight: bold; FONT-FAMILY: Times New Roman; " id="hcentro"> 
</div> 

同じ:

hcentro divが空であるミー・ガイズ

答えて

0

を助けてください。

理由は値がjavascriptで作成されているためです。 JavaScriptコードを深く掘り下げたいと思うかもしれません。

あなたがREST serviceあるいはa local public file

+0

感謝のlaurイワンを使用していないのはなぜ、好奇心旺盛なことはVB6を使用して、私はhtmlDomオブジェクトに外部URLの時刻と日付を得ることができるということです。 –

関連する問題