simple_html_dom_node::getElementById PHP Method

getElementById() public method

public getElementById ( $id )
    function getElementById($id)
    {
        return $this->find("#{$id}", 0);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Return the HTML string of just the given ID.
  * @param $id string
  * @param $pop boolean - remove the element when done processing?
  * @return string
  * @throws \Exception
  */
 public function getId($id, $pop = true)
 {
     if ($node = $this->html->getElementById($id)) {
         $html = $this->process($node);
         if ($pop) {
             $node->outertext = "";
         }
         return $html;
     }
     return "";
 }