php - Get attribute name with simple HTML DOM? -


I am trying to attribute value in the data-date , Inside the & lt; Ul & gt; Tags

Sample Code:

  & lt; Ul class = "media-list" & gt; & Lt; Li class = "media-item" data-date = "2014-04-24 07:30:29" & gt; Tess & lt; / li & gt; & Lt; Li class = "media-item" data-date = "2014-04-25 08:30:29" & gt; Tess & lt; / li & gt; & Lt; Li class = "media-item" data-date = "2014-04-26 09:30:29" & gt; Tess & lt; / li & gt; & Lt; / Ul & gt;   

I have to get those values ​​in the list, the desired output is below:

(2014-04-24 07:30:29, 2014 - 04-25 08:30:29, 2014-04-26 09:30:29)

The following code will work perfectly to get the data-date value of each Lee.

  & lt ;? Includes php ('inc / simple_html_dom.php'); $ HTML = str_get_html ('& lt; ul class = "media-list" & gt; li class = "media item" date of data = "2014-04-24 07:30:29" & gt; Tes  
  • gt; '); Foreach ($ html- & gt; looks ('ul.media-list li.media-item') as $ li) {$ echo echo & gt; { 'data date'}. "& lt; br & gt;"; }? & Gt;

  • Comments

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -