i trying timestamp of date-time in html.
<span class="js-short-timestamp js-relative-timestamp" data-time="1401528672" data-long-form="true"> 15h </span>
using html simple dom how value "1401528672" html. yes value/timestamp change need value of [date-time] in html.
any ideas?
include('simplehtmldom/simple_html_dom.php'); $html = file_get_html("https://twitter.com/$user"); //not working $date = $html->find('span[data-time]->attribute()', 0); print_r($date); exit;
try below code:
include('simplehtmldom/simple_html_dom.php'); $html = str_get_html('<span class="js-short-timestamp js-relative-timestamp" data-time="1401528672" data-long-form="true"> 15h </span>'); $data = $html->find('span', 0); echo $data->attr['data-time'];
@papa de beau: tried above code using simplehtmldom , worked :)
Comments
Post a Comment