Skip to content

Instantly share code, notes, and snippets.

@kaynenh
Created May 11, 2016 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaynenh/319673575792e583bd8a4d4c5ec248f0 to your computer and use it in GitHub Desktop.
Save kaynenh/319673575792e583bd8a4d4c5ec248f0 to your computer and use it in GitHub Desktop.
Shell concept for removing node from loaded html
$string = "<<<HTML" . $this->remoteResponse->getBody() . "
HTML";
$dom = new DOMDocument();
$dom->loadHTML($string);
$xpath = new DOMXpath($dom);
$nlist = $xpath->query("//button[@id='id-of-button']");
$node = $nlist->item(0);
$node->parentNode->removeChild($node);
var_dump($this);
$this->setBody($dom->saveHTML());
//echo $this->remoteResponse->getBody();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment